Answer the question
In order to leave comments, you need to log in
How to direct to robots path in .htaccess?
The subdomain site is located in the main site and opens from a separate folder.
It takes a long time to explain why.
How to set up a separate robots.txt for such a subdomain?
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} /sitemap.*?\.xml
RewriteRule ^(.*)$ /bitrix/tools/sitemap.wrapper.php [L]
RewriteCond %{HTTP_HOST} ^(www\.)?subdomain\.site\.ru$ [NC]
RewriteCond %{REQUEST_URI} !/subdomain
RewriteCond %{REQUEST_URI} !less$ [NC]
RewriteRule (.*) /subdomain/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
RewriteCond %{HTTP_HOST} ^www.static.*$ [NC]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*robots\.txt.*\ HTTP/ [NC]
RewriteRule ^robots\.txt /robots_static.txt [NC,L]
Answer the question
In order to leave comments, you need to log in
https://redseo.ru/otdelnyj-robots-i-sitemap-dlya-p...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question