ReWrite Rule

Jul 5, 2007 at 8:23 AM

I have a single website (single directory) with multiple domains e.g,, etc. What I would be like to do is to have multiple robots.txt files for each domain? How do I go about doing so?
Jul 5, 2007 at 11:19 PM
This is my first attempt and it doesn't seem to work. Can anyone help?

RewriteCond %{REMOTE_ADDR} ^(
RewriteRule (^/robots.txt)(.*\/$)$ /test.txt R,I
Jul 5, 2007 at 11:43 PM
This is my updated code however it only works if I type in localhost/robots.txt. If I were to type in localhost/dir1/robots,txt or localhost/dir/dir2/robots.txt it fails to work. How can I get it work regardless of the number of sub directories?

RewriteCond %{HTTP_HOST} ^localhost$
RewriteRule (^/robots.txt)$ /test.txt R,I
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (^/test.txt)$ /robots.txt I,L
Jul 13, 2007 at 6:39 PM
check the docs on Regular Expressions, and also check the examples and tests.
you should be able to figure this out.