I have a site with multiple domains and i need a robots.txt for each domain.
For example:
example.com will have robots-com.txt
example.se will have robots-org.txt
example.co.uk will have robots-co.uk.txt
etc... And the URL would be example.com/robots.txt
So I wrote this:
RewriteRule ^.*example\.(.*)/robots\.txt robots-$1.txt [L]
(i thought) that it would take the domain and add it to the end of the robots file. But it doesn't work.
How should I do, is it possible?
I rewrote it like this, still doesn't work:
RewriteCond %{HTTP-HOST} ^.*example\.(.*)$
RewriteRule ^robots\.txt$ robots-%1\.txt [L]
Working solution::
RewriteCond %{HTTP_HOST} ^.*example\.(.*)$
RewriteRule ^robots\.txt$ /robots-%1\.txt [L]