cancel
Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.

Redirect customername.domain1.com/path/ to customername.domain2.com/path/

Anthony_Santi
Nimbostratus
Nimbostratus

Hi,

I am trying to find a solution for an upcoming environment replacement. We want the first part of the hostname to stay the same while replacing the domain name. We need to accept both domains for some period of time. The path should also stay the same as originally entered. We can use SNI for certificates on the virtual server.  

Any help is appreciated.

Thanks,

 

2 REPLIES 2

Hi Anthony Santi,

when HTTP_REQUEST { if { [HTTP::host] ends_with ".domain1.com" } { HTTP::redirect https://[string map {"domain1" "domain2"} [HTTP::host]][HTTP::uri] return } }

 

SanjayP
MVP
MVP

You can also try this way.

when HTTP_REQUEST { HTTP::respond 301 Location "https://[getfield [HTTP::host] "." 1].domain2.com[HTTP::uri]" return }