redirect based on user input urls

I want to redirect all *.web1.com address to *.web2.com

for example,

when user input abc.web1.com,it will be redirect to abc.web2.com

input abcdef.web1.com will be redirect to abcdef.web2.com

and the number of addresses is over 300…

please give me some suggestions

thanks :slight_smile:

Hi toofat,

Can you try this iRule?

when HTTP_REQUEST {
	if { [HTTP::host] ends_with "web1.com" } {
		set newHost [string map {"web1.com" "web2.com"} [HTTP::host]]
		HTTP::redirect "https://$newHost[HTTP::uri]"
	}
}

Thank you very very much~~

this is exactly what I want

Thanky you :slight_smile: