Forum Discussion
Martin_Thomas_1
Dec 04, 2013Nimbostratus
Replace part of HTTP::host and permanently redirect
I'm looking at redirecting various hosts to a new domain.
Example 1: app.olddomain.com to app.newdomain.com Example 2: anotherapp.olddomain.com to anotherapp.newdomain.com
The problem I'm having ...
- Dec 05, 2013
Either (this is probably more efficient);
when HTTP_REQUEST { if {[HTTP::host] ends_with ".olddomain.com"} { HTTP::respond 301 Location "https://[getfield [HTTP::host] . 1].newdomain.com[HTTP::uri]" } }
Or;-
when HTTP_REQUEST { if {[HTTP::host] ends_with ".olddomain.com"} { HTTP::respond 301 Location "https://[string map {olddomain newdomain} [HTTP::host]][HTTP::uri]" } }
giltjr
Dec 05, 2013Nimbostratus
Not 100% sure but something like the following may work:
regsub -all ".olddomain.com" [HTTP::host] ".newdomain.com" newhost HTTP::respond 301 Location "https://$newhost[HTTP::uri]"
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