Hi, i am trying to accomplish the following:
1) if user enters abc.com redirect to https://www.abc.com
2) if user enters www.abc.com redirect to https://www.abc.com
I am trying to use the following irule:
when HTTP_REQUEST priority 100 {
if { [HTTP::host] eq [domain [HTTP::host] 2] } {
HTTP::redirect “https://www.[HTTP::host]”
}
}
when HTTP_REQUEST priority 200 {
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
But its not working. If user enters abc.com, user gets Page Cannot Be Displayed. if user enters www.abc.com it correctly redirects to https://www.abc.com.
I have tried breaking it out into 2 separate irules, applied in order 1 then 2.
Still, same result - abc.com gets page cannot be displayed, www.abc.com redirects properly to https://www.abc.com.
If i remove the priority 200 code completely, leaving
when HTTP_REQUEST priority 100 {
if { [HTTP::host] eq [domain [HTTP::host] 2] } {
HTTP::redirect “https://www.[HTTP::host]”
}
}
Then scenario 1 does work, so i know that that code is good. However, the 2 pieces together just will not work. Am i doing something wrong here?
Thanks,
Jodie