Answer the question
In order to leave comments, you need to log in
How to make a 301 redirect for a site with subdomains?
Hello.
In general, the site is moving to a new domain and all requests that refer to the old domain should be redirected to the new domain, including subdomains.
For example, for the main domain, the rule seems to be something like this:
RewriteCond %{HTTP_HOST} ^old-site\.ru$ [NC]
RewriteRule ^(.*)$ http://www.new-site.ru/$1 [R=301,L]
Answer the question
In order to leave comments, you need to log in
RewriteCond %{HTTP_HOST} ^old-site\.ru$ [NC]
RewriteRule ^(.*)$ http://www.new-site.ru/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+)\.old-site\.ru$ [NC]
RewriteRule ^(.*)$ http://%1.new-site.ru/$1 [R=301,L]
#
old-site.ru -> www.new-site.ru
www.old-site.ru -> www.new-site.ru
one.old-site.ru -> one.new-site.ru
www.one.old-site.ru -> one.new-site.ru
two.old-site.ru -> two.new-site.ru
www.two.old-site.ru -> two.new-site.ru
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question