A
A
Alexander Ivanov2017-01-31 15:51:15
Apache HTTP Server
Alexander Ivanov, 2017-01-31 15:51:15

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>

I have seen some options:
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]

How to set up correctly?
PS thanks for the sympathy.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ildar r. khasanshin, 2017-07-28
@ildarkhasanshin

https://redseo.ru/otdelnyj-robots-i-sitemap-dlya-p...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question