Forum Discussion
William_Turner_
Nimbostratus
Dec 05, 2017301 redirect with uri rewrite
Hello,
I have a need to create both a 301 redirect and also a URI rewrite in the same iRule.
Currently I have a site that I'll need to perform a 301 redirect on that is similar to https://some.e...
William_Turner_
Nimbostratus
Dec 05, 2017Thoughts on if this iRule would meet the above needs and perform the correct 301 redirect?
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"some.example.com" {
if { [HTTP::uri] starts_with "/content"}{
set uri [HTTP::uri [string map {"/content" ""} [HTTP::uri]]]
HTTP::respond 301 Location "https://another.example.com$uri"
}
default {HTTP::respond 301 Location "https://another.example.com[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
