Answer the question
In order to leave comments, you need to log in
How to generate robots.txt for all subdomains with a new host?
I am moving to a new domain.
Now .htaccess looks like this:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^((?:[^.]+\.)*)domain1.ru$ [NC]
RewriteRule "" https://%1domain2.ru%{REQUEST_URI} [R=301]
Answer the question
In order to leave comments, you need to log in
Yandex has long abandoned the Host directive.
https://yandex.ru/blog/platon/pereezd-sayta-after-...
Write a rule in the server configs so that the robots.txt request is redirected to the generate_robots_file.php handler. In it, generate the content of the file based on the subdomain and return the content with the header "Content-Type: text/plain".
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question