Greetings to all gentlemen

There is such a thing robots.txt. There is a hell number of domains aimed at 1 hosting. Can I use redirection (.htaccess) on different robots.txt files for different hosting?

ΠΏΡ€ΠΈ Π΄ΠΎΠΌΠ΅Π½1/robots.txt - ΠΏΠ°ΠΏΠΊΠ°1/robots.txt ΠΏΡ€ΠΈ Π΄ΠΎΠΌΠ΅Π½2/robots.txt - ΠΏΠ°ΠΏΠΊΠ°35/robots.txt ΠΏΡ€ΠΈ Π΄ΠΎΠΌΠ΅Π½3/robots.txt - ΠΏΠ°ΠΏΠΊΠ°999/robots.txt 

ps probably everything is up to me laugh, but I thought so (probably not right)

 RewriteCond http://site1.ru/robots.txt ^rew1/robots.txt [NC] RewriteCond http://site2.ru/robots.txt ^rew35/robots.txt [NC] RewriteCond http://site3.ru/robots.txt ^rew999/robots.txt [NC] 
  • it is possible, though it is not clear what exactly you want and what is the difficulty? - zb '
  • Send to a specific file, at a specific address, for short. Tell me how to write? - frank

1 answer 1

Do all domains specify the same directory? If yes, then:

 RewriteBase / RewriteCond %{HTTP_HOST} domain1.com$ #Π²ΠΊΠ»ΡŽΡ‡Π°Ρ субдомСны Rewriterule ^robots.txt$ dir1/robots.txt [L] RewriteCond %{HTTP_HOST} domain2.ru$ Rewriterule ^robots.txt$ dir2/robots.txt [L] 
  • Works. This is genius! - frank