Forum Discussion
Joe_Pipitone
Nimbostratus
Aug 25, 2009Redirect rule somewhat working
Hello all,
I'm having a small issue with an iRule. My rule is below:
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] equals "/redirectme" } {
...
hoolio
Cirrostratus
Aug 25, 2009You could check for /redirectme or /redirect/me/ with a switch statement:
when HTTP_REQUEST {
switch [string tolower [HTTP::uri]] {
"/redirectme" -
"/redirectme/" {
HTTP::redirect "http://sitename.com/newuri"
}
}
}
Or you could check for anything starting with /redirectme using the -glob flag on switch:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/redirectme*" {
HTTP::redirect "http://sitename.com/newuri"
}
}
}
Or if you like the 'if' format, you could use this:
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] equals "/redirectme" or [string tolower [HTTP::uri]] equals "/redirectme/" } {
HTTP::redirect "http://sitename.com/newuri"
}
}
Aaron
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
