B
B
bossigorxxx2020-02-08 13:58:18
htaccess
bossigorxxx, 2020-02-08 13:58:18

How to redirect all subdomain pages to domain pages?

We need a redirect from a subdomain to a domain. It translates to the main page, but not to the pages. Tried like this:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^msk.site.ru$ [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]

and so too:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.|)msk\.site\.ru [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]


RewriteEngine On

RewriteCond %{HTTP_HOST} msk\.site\.ru$ [NC]
RewriteRule ^ https://site.ru%{REQUEST_URI} [R=301,L,NE]

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question