Forum Discussion
DaveC_53879
Nimbostratus
May 26, 2011Need help with a URL re-write
I need an iRule to look for "foldername" in the URL below,
http://web.com/foldername/tap/?empid=00000000
and then re-write to the URL below, removing "foldername" completely. The...
hoolio
Cirrostratus
May 26, 2011Hi Dave,
I think something like this should work:
when HTTP_REQUEST {
if {[HTTP::path] starts_with "/foldername"}{
HTTP::redirect "https://newsub.newdomain.org[string range [HTTP::uri] [string first "/" [HTTP::uri] 1] end]"
}
}You can add debug logging to check the values for [string first "/" [HTTP::uri] 1] and [string range [HTTP::uri] [string first "/" [HTTP::uri] 1] end] to see how it works. The idea is that you get the first / after the first character in the URI and then read from that to the end of the original URI to determine the URI for the redirect.
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