Forum Discussion
muzammil_88686
Nimbostratus
Dec 11, 2012Optimizing Multiple URL redirections
Dear Dev Team,
I have a request to redirect the below URLs
www.xyz.com/p/cal2013/m1 to www.xyz.com/w/c/MC/SC/CAL2013/m1
www.xyz.com/p/cal2013/m2 to www.xyz...
What_Lies_Bene1
Cirrostratus
Dec 12, 2012I'd suggest you make use of a Data Group. Here's an example;
Create a Data Group with string and value pairs of the source URI and
associated URI to be redirected to. E.g string=/olduri1, value=/newuri1
when HTTP_REQUEST {
Compare the request URI with the strings in the uri-dg data group
and populate the variable: redirect with the associated value if
there is a match
set redirect [class match -value [HTTP::uri] equals uri-dg]
As long as our variable: redirect isn’t empty, perform the redirect
if { $redirect ne "" } {
HTTP::redirect $redirect
}
If there wasn’t a match and variable: redirect is empty, do something
else instead
else {
log local0. "No redirect occurred for: [HTTP::uri]"
}
}
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