Forum Discussion
DM_5174
Nimbostratus
Nov 09, 2007case-sensitive URL redirection - Code conversion
Hi all,
I have created the iRule below with the help of users on this forum in version 4.x, however we also have LBs with version 9.x. Please help me in converting this to version 9.x?
Basica...
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
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects