Forum Discussion
Bryan_Chick_152
Nimbostratus
Aug 18, 2006Redirect based on position of word in uri
Hi all,
I posted a question a couple days ago, but mispoke in the question. I am posting the modified question here again as a new post.
I need a rule that redirects for a cer...
Aug 18, 2006
You've been presented with some if statements, here's a switch option you can use that should do what you want.
when HTTP_REQUEST {
switch -glob "[HTTP::host][HTTP::uri]" {
"vw.com/golf" -
"vw.com/golf/*" {
HTTP::redirect "http://vw.com/rabbit"
}
}
}Here's another one that should work:
when HTTP_REQUEST {
if { "[HTTP::host][HTTP::uri]" starts_with "vw.com/golf" } {
HTTP::redirect "HTTP://vw.com/rabbit"
}
}The downside to the second version is that this would redirect as well "http://vw.com/golfer" since it starts with "vw.com/golf". You could change the comparison to "vw.com/golf/" but that would exclude "http://vw.com/golf". I believe the switch example above will cover both options.
-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
