A
A
Alex Grudko2016-07-06 02:17:59
URL Handling
Alex Grudko, 2016-07-06 02:17:59

301 redirect when moving a site to a new domain?

Hello, tell me please. The question arose of transferring the site to a new domain, the main mirror of the old https domain and the new domain will also be the main https mirror. The question is how to make the correct redirect?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2016-07-06
@shambler81

Option 1
RewriteEngine On
RewriteCond %{HTTPS} =off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L]
Option 2
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https ://%{SERVER_NAME}%{REQUEST_URI} [R,L]
if both of the first options fail and a circular redirect occurs:
Option 3
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_UR

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question