Forum Discussion
SSell
Altostratus
Sep 18, 2015iRule to redirect to new url, but retain path after first location
I have been tasked with creating an irule to redirect a url to a new server. However the existing server will still have other urls still working on it. We need to retain everything in the URL afte...
Brad_Parker
Cirrus
Sep 23, 2015For a permanent redirect you would use this to do a 301:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "www.abc.com" and [string tolower [HTTP::uri]] starts_with "/app/" } {
HTTP::respond 301 noserver Location "https://app.def.com/[string map {/app/ /} [string tolower [HTTP::uri]]]"
}
}
Brad_Parker
Cirrus
Sep 23, 2015You probably want to add string tolower to prevent case mis-match compares. I update above.
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