.htaccess redirect old domain to new domain while respecting HTTPS -
this question has answer here:
- https non www https www 1 answer
i know question must have been asked before unable find specific answer question. have multiple pointer domains setup pointing branded domain. redirect http using (note below domain.com signifies branded domain):
rewriteengine on rewritecond %{http_host} !^www\.domain\.com rewriterule (.*) http://www.domain.com/$1 [r=301,l] however not redirect https. i've tried:
rewriteengine on rewritecond %{https} on rewritecond %{https_host} !^www\.domain\.com rewriterule (.*) https://www.domain.com/$1 [r=301,l] rewritecond %{http_host} !^www\.domain\.com rewriterule (.*) http://www.domain.com/$1 [r=301,l] but results in redirect loop. in essence want maintain protocol (either http or https) , redirect old new domain while leaving remainder of request intact.
so if example tries lookup:
http://www.pointerdomain.com/dingos.html the resulting be:
http://www.domain.com/dingos.html and request to:
https://www.pointerdomain.com/flapjacks.html would forward to:
https://www.domain.com/flapjacks.html if provide little insight appreciate it.
here give try. should work both scenarios of http or https.
rewritecond %{http_host} !^www\.domain\.com [nc] rewritecond %{https}s ^on(s)| rewriterule ^ http%1://www.domain.com%{request_uri} [l,r=301]
Comments
Post a Comment