Forum Discussion
Karlsen_58024
Nimbostratus
Nov 28, 2012HTTP Redirection iRules
Hi,
A customer wanted a new web solution and chose Big-IP 3900 to use as a load balancer. They want to migrate from the existing environment to the new one with as little downtime / 404 errors a...
Brian_Deitch_11
Nov 28, 2012Historic F5 Account
If you are not a fan of multiple IF statements or data groups you could do nested switches:
when HTTP_REQUEST {
switch -glob [ string tolower [HTTP::host]] {
*example.com* {
switch -glob [ string tolower [HTTP::uri]] {
*thisisanoldsite* { HTTP::redirect "https://www.example.com/this/is/the/equivilant/site" }
*/hey/whatsup.aspx* { HTTP::redirect "https://www.example.com/abc/def/example.aspx" }
*/page206.aspx* { HTTP::redirect "https://www.example.com/subsite/URI/page.aspx" }
*/aboutthispage* { HTTP::redirect "https://www.example.com/About/Page.aspx" }
default { HTTP::respond 301 noserver Location "https://www.example.com" }
}
}
*nextdomain.com* {
switch -glob [ string tolower [HTTP::uri]] {
*thisisanoldsite* { HTTP::redirect "https://www.nextdomain.com/this/is/the/equivilant/site" }
*/hey/whatsup.aspx* { HTTP::redirect "https://www.nextdomain.com/abc/def/nextdomain.aspx" }
*/page206.aspx* { HTTP::redirect "https://www.nextdomain.com/subsite/URI/page.aspx" }
*/aboutthispage* { HTTP::redirect "https://www.nextdomain.com/About/Page.aspx" }
default { HTTP::respond 301 noserver Location "https://www.nextdomain.com" }
}
}
}
}
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