Answer the question
In order to leave comments, you need to log in
How to make a redirect from all subdomains except one to the main one?
RewriteCond %{HTTP_HOST} ^([a-z0-9_-]+).site\.ru$
RewriteCond %{HTTP_HOST} !=spb.site.ru [NC]
RewriteRule ^(.*) http://site.ru/$1 [R=301,L]
Answer the question
In order to leave comments, you need to log in
RewriteCond %{HTTP_HOST} ^.+\.site\.ru$
RewriteCond %{HTTP_HOST} !^spb\.site\.ru$ [NC]
RewriteCond %{HTTP_HOST} !^www\.site\.ru$ [NC]
RewriteRule ^(.*) http://site.ru/$1 [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question