Rohan
Apr 02, 2020Nimbostratus
irule for redirection
I have below requirement and and I have draft below iRule, Will it work ?
a. If user try to access http://abc.com/ or http://10.10.10.10/ redirects to https://www.abcworld.com/
b. If user try to access http://abc.com/* or http://10.10.10.10/* redirects to https://www.abc.com/*
Note: * is means any uri.
abc.com = 10.10.10.10
www.abcworld.com = 1.2.3.4
www.abc.com = 5.6.7.8
when HTTP_REQUEST {
if { (([string tolower [HTTP::host]] eq "abc.com") || ([HTTP::host] eq "10.10.10.10")) && ([HTTP::uri] eq "/") } then
{
HTTP::redirect "https://www.abcworld.com/"
}
elseif { ([string tolower [HTTP::host]] eq "abc.com") || ([HTTP::host] eq "10.10.10.10") } then
{
HTTP::redirect "https://www.abc.com[HTTP::uri]"
}
else {
}
}