M
M
Maxim Zolotoy2018-05-24 15:20:47
htaccess
Maxim Zolotoy, 2018-05-24 15:20:47

Am I doing the right 301 redirect?

Tell me if I did the redirect correctly?
I want any request to the old site to be sent to the new one.
and here HTTP_HOST is also indicated in the text - is this normal if my site is on https?
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} robots.txt$ [NC]
RewriteRule ^([^/]+) $1 [L]
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ newdomain.com /$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.domain\.com
RewriteRule ^(.*)$ www.newdomain.com/$1 [R=301,L]
and
User- agent: Yandex
Host: newdomain.com
User-agent: *
Disallow:
Sitemap:newdomain.com/sitemap.xml

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2018-05-24
@Lopar

Redirecting the entire site to a new one on HTTPS:

RewriteCond %{SERVER_PORT} ^80$ [OR]
RewriteCond %{HTTP} =on
RewriteRule ^(.*)$ https://domain.ru/$1 [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question