Forum Discussion
Nov 09, 2007
In 9.x iRules, string case is a lot easier to manage with the help of the TCL string command.
This should work for you.
when HTTP_REQUEST {
if { ([HTTP::host] equals "www.primarysite.com") && ([string tolower [HTTP::uri]] equals "/home") } {
HTTP::redirect "https://www.secondarysite/secure/"
} else {
pool APACHE_WEB_SERVERS
}
}
Or, better yet, if you have APACHE_WEB_SERVERS as the default pool within the Virtual Server, you can omit the else clause:
when HTTP_REQUEST {
if { ([HTTP::host] equals "www.primarysite.com") && ([string tolower [HTTP::uri]] equals "/home") } {
HTTP::redirect "https://www.secondarysite/secure/"
}
}
Keep in mind that you can also use the "starts_with" operator in the HTTP::uri comarison if you want to match all URIs that, well, start with "/home" (ie, /home/one, /home/two, ...)
Let me know if this doesn't work for you...
-Joe