Y
Y
yooooooman2018-03-16 06:03:29
htaccess
yooooooman, 2018-03-16 06:03:29

How to redirect a site and its subdomains?

Good day!
We have:
Domen1 - we will call it olddomen.ru
Domen2 - we will call it newdomen.ru
There are also many regional subdomains of the same name both on the old and on the new domain.
The plans are to move from the old domain to the new one while preserving the URLs, i.e., so that it doesn’t throw, for example, from the page olddomain.ru/url to the newdomain.ru or newdomain.ru/index.php
It is also necessary that from the subdomains of the old site threw on similar (by name) subdomains of the new site and in the same way with the preservation of urls. While we do not prescribe specific names of subdomains like:
RewriteCond %{HTTP_HOST} ^novosibirsk\.olddomain\.ru [NC]
RewriteRule ^(.*)$http://novosibirsk.novydomen.ru/$1 [R=301,L]
because there are too many domains.
Is it possible somehow to implement this using rules in .htaccess?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2018-03-16
@sidni

try like this

RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ http://%1/$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