looking for an opinion on this https redirect irule
Hey Everybody, I wonder if I can get your opinion on my irule.
I am tasked with creating an http to https redirect but at the same time they would like to make some tweaks for SEO reasons. we are looking for the following:
1)If it comes in as placeone.com with no uri -go to https://www.placetwo.com/subplace/ with no uri 2)If it comes in as placeone.com with a uri -go to https://placeone.com with the uri attached. 3)If it comes in as www.placeone.com with no uri -go to https://www.placetwo.com/subplace/ with no uri 4)If it comes in as www.placeone.com with a uri -go to https://placeone.com with the uri attached 5)Everything left -go to https://placeone.com with the uri attached
I am using:
when HTTP_REQUEST { if { [string tolower [HTTP::host]] eq "www.placeone.com" } { if { [HTTP::uri] eq "/" } { HTTP::respond 301 Location "https://www.placetwo.com/subplace/" } } if { [string tolower [HTTP::host]] eq "placeone.com" } { if { [HTTP::uri] eq "/" } { HTTP::respond 301 Location "https://www.placetwo.com/subplace/" } else { HTTP::respond 301 Location "https://www.placeone.com[HTTP::uri]" } } }
It's a little bit complicated for me so I don't know if rule or even the syntax will work.
Thanks!