Adam_Borders_10
Aug 18, 2011Nimbostratus
iRule Newbie learning - need validation
I want to validate the this iRule will do as I think. What I want to do is evaluate the request for a redirect to https. If the user connects to domain.com instead of www.domain.com I want to add the www. during the redirect.
http://www.mydomain.com -> https://www.mydomain.com
http://mydomain.com -> https://www.mydomain.com
The Rule:
when HTTP_REQUEST {
if { not ([string tolower [HTTP::host]] starts_with "www.")}{
HTTP::redirect "https://www.[HTTP::host][HTTP::uri]"
}
else{
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}
Thanks for all your help on this in advanced. I don't have much of a dev area to play with yet so I am trying to be careful before deploying any of these.
Adam Borders