Forum Discussion
Nov 14, 2009
NOT start with
Hello All,
Does anyone know the syntax for using "NOT start with" when doing a comparison with the URI?
ex)
This should do a 301 redirect if the URI does NOT start wi...
hoolio
Cirrostratus
Nov 16, 2009Hi Trx,
not and ! are the same in iRules. A URI can't have a literal space in it--it must be URL encoded to %20.
You could use a switch statement to do this:
when HTTP_REQUEST {
Check the requested URI
switch -glob [HTTP::uri] {
/[sS]olutions {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched /solutions check."
if {! ([HTTP::uri] starts_with "/Solutions%20Guide") }{
log local0. "[IP::client_addr]:[TCP::client_port]: Did not match /Solutions%20Guide"
HTTP::respond 301 Location "http://[HTTP::host]/erp/Solutions"
}
}
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
