M
M
Mark2020-10-16 08:32:03
WordPress
Mark, 2020-10-16 08:32:03

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

1 answer(s)
B
bossigorxxx, 2020-10-17
@bossigorxxx

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 question

Ask a Question

731 491 924 answers to any question