Forum Discussion
Walter_WorkAcct
Altostratus
Apr 24, 2021iRule with multiple 301 redirects only redirecting main URI
I am new to the F5 and working on an irule to 301 permanently redirect traffic from links to our old site to new locations on the new site. The issue is that only the default portion of the code is w...
Apr 24, 2021
Hi Walter_WorkAcct,
You should use [HTTP::host] to compare "oldsite.ournewsite.net"
when HTTP_REQUEST {
if { [HTTP::host] equals "oldsite.ournewsite.net" } {
switch -glob [HTTP::uri] {
"*/foo" { HTTP::respond 301 Location https://ournewsite.net/oldsitestuff/foo }
"*/bar" { HTTP::respond 301 Location https://ournewsite.net/oldsitestuff/bar }
default { HTTP::respond 301 Location https://ournewsite.net/oldsitestuff }
}
}
}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
