Stuart_Feathers
Sep 28, 2012Nimbostratus
Redirect with multiple conditions
I am doing a HTTPS redirect for all of the sites at my domain. I need to make an exclusion for 2 sites so that they can be access via HTTP.
For example, any traffic to http://www.abc.com is redirected to https://www.abc.com. I would like requests to http://www.abc.com/site1 and http://www.abc.com/site2 to be allowed to go to the HTTP site while all other traffic is redirected to HTTPS.
I've attempted to do this with the following iRule, but it is not working. Any assistance would be greatly apreciated.
Thanks!
when HTTP_REQUEST {
if { not ([string tolower [HTTP::uri]] starts_with "/site1") } {
HTTP::respond 301 Location "https://www.abc.com[HTTP::uri]"
}
elseif { not ([string tolower [HTTP::uri]] starts_with "/site2") } {
HTTP::respond 301 Location "https://www.abc.com[HTTP::uri]"
}
}