K
K
Konstantin2022-04-07 09:31:48
htaccess
Konstantin, 2022-04-07 09:31:48

How to make a 301 redirect from a subdomain to a subdomain?

I have many sites like

city.domain.ru
city1.domain.ru

We have changed the main domain, how can I make all subdomains redirect to the new subdomains?

city.domainnew.ru
city1.domainnew.ru

To have a universal solution and not write a redirect for each city

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2022-04-07
@gradk

RewriteCond %{HTTP_HOST} ^(.+)\.domain\.ru
RewriteRule .* https://%1.domainnew.ru/$0 [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question