Answer the question
In order to leave comments, you need to log in
How to redirect from a subdomain to the main domain?
Hello, tell me how to redirect from subdomains to the main domain, an example of links below:
https://moscow.site.ru/blog/smartylife/10-knig-dly...
to
https://site.ru/blog/smartylife /10-knig-dlya-pogr...
Answer the question
In order to leave comments, you need to log in
Redirect from one subdomain to a domain
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^poddomen.site.ru$ [NC]
RewriteRule ^(.*)$ https://site.ru%{REQUEST_URI } [R=301,NC, L,QSA]
Redirect from all subdomains to the main domain
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(.+).site.ru$
RewriteRule (.*) https://site.ru/$1 [L,R=301 ,QSA]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question