Forum Discussion
cymru81
Altocumulus
Nov 18, 2015iRule redirect help!
Hi, im looking to create an iRule to do some redirects depending on url requested. I think i have it working but am concerned about the case eg small 'a' or big 'A' as the redirect doesnt work if it...
Michael_Jenkins
Cirrostratus
Nov 18, 2015If you were going to use an iRule, I'd suggest something like this. (You can use
[string tolower XXX] to get the lowercase version of a string.
when HTTP_REQUEST {
switch [string tolower [HTTP::path]] {
"/" {
HTTP::redirect "http://[HTTP::host]/home/live"
}
"/a" {
HTTP::redirect "http://[HTTP::host]/a/"
}
"/testinst" {
HTTP::redirect "http://[HTTP::host]/testinst/"
}
default {
}
}
}
If you're running 11.4 or later, you could also consider using a Local Traffic Policy instead since this would be a simple rule. (Here's a link on how to create a redirect). Because they're built into the core, local traffic policies are a little more efficient than an iRule.
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