I have two sites both being indexed by google using the same codebase:
dev.mysite.com and example.com
I want to serve a different robots.txt based on each domain.
Currently I have:
RewriteBase /
RewriteCond %{HTTP_HOST} ^dev\.mysite\.com$ [NC]
RewriteRule ^robots\.txt$ robots\.txt\.dev [L]
However this doesn't seem to work. Can someone point me in the right direction.
For me worked following by adding extra condition
RewriteCond %{HTTP_HOST} ^dev\.mysite\.com
RewriteCond %{REQUEST_URI} (robots\.txt)
RewriteRule .* robots-dev.txt [L]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With