Irule forwarding with various options
Hey Guys,
I've been asked to create a rule forwarding to various places depending on various requests. the options are as follows:
http://www.mysite.com https://www.bettersite.com/mysite/
http://www.mysite.com https://www.bettersite.com/mysite/
http://www.mysite.com/* https://www.mysite.com/* http://mysite.com https://www.bettersite.com/mysite/
http://mysite.com/ https://www.bettersite.com/mysite/
http://mysite.com/* https://www.mysite.com/*
I created the following and the F5 accepted it but i have a sneaking feeling something is wrong or at least this isn't the best way to do things. Can anyone give me their opinion as to if this works or is there something better?
when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "mysite.com" } { HTTP::redirect https://www.bettersite.com/mysite/ } if { [string tolower [HTTP::host]] equals "www.mysite.com" } { HTTP::redirect https://www.bettersite.com/mysite/ } if { [string tolower [HTTP::host]] contains "mysite.com/" } { HTTP::redirect https://www.bettersite.com/mysite/[HTTP::uri] } if { [string tolower [HTTP::host]] contains "www.mysite.com/" } { HTTP::redirect https://www.bettersite.com/mysite/[HTTP::uri] } else { HTTP::respond 301 Location https://www.mysite.com/[HTTP::uri] return } }