Forum Discussion
ebowers_25830
Nimbostratus
Nov 22, 2013Irule for Redirecting 15 paths to new url
Hello
I have been asked to redirect an url that has 15 differant paths to a new url with a modified path
Here is and expample
www.xyz.com/2013/11/07/enterprise-risk-management-getting-the-ton...
Kevin_Stewart
Employee
Dec 16, 2013You have an errant closing square bracket after your conditional if statement and the "genreperspective" string would be in the [HTTP::host] value, not the [HTTP::path]. Otherwise, if you can guarantee that the "/2013/x/x" URI pattern always exists before the URI portion that you want to capture, then you can also do this:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "www.genreperspective.com" } {
set newuri [lindex [split [HTTP::uri] "/"] 4]
HTTP::redirect "http://www.genre.com/knowledge/blog/${newuri}.html"
}
}
This is simply splitting the incoming URI into a list and plucking out the 5th element (similar to Pete's getfield command).
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