Answer the question
In order to leave comments, you need to log in
How to make a redirect from the internal page of any subdomain to the internal page of the main domain?
Hello everyone)
Please tell me how to implement this. There is a site on Bitrix and it has subdomains with regions
. And inside there is a section with articles. The bottom line is to prevent duplicate articles in search engines.
Here you need to make it so that when you visit an article from subdomains, it redirects to this article on the main domain Here is an example, you need to
redirect to https ://site
from this page .ru/news/stati/statya1/
It seems to be not such a difficult task, but the code below does not work :(
RewriteCond %{HTTP_HOST} ^(?>www\.|)(.+)\.site\.ru/news/ stati/(.+)$ [NC]
RewriteRule ^(.*)$ https://site.ru/news/stati/%1/ [R=301,L]
Answer the question
In order to leave comments, you need to log in
Look carefully at your routine. The first parameter is not the title of the article, but the subdomain.
RewriteCond %{HTTP_HOST} ^(www\.|)sub1\.site\.ru$
RewriteRule ^(.+)$ https://site.ru/$1? [L,R=301]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question