###mod_rewrite
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
# Don't really need to verify robots.txt is a directory
RewriteRule /robots.txt http://masterhost.domain.com/robots.txt [L]
If I use "http://" in the substitution string, it issues an HTTP
redirect, which I don't want. (I want each robots.txt to be served
from its own domain.)
###Or even easier with mod_alias
Alias /robots.txt /www/public/robots.txt
The Alias command works, with one exception: The file at /www/
public/robots.txt is always served, even if a VirtualHost has its
own robots.txt file. Is there a way to do the equivalent of
RewriteCond %{REQUEST_FILENAME} !-f with an Alias command?
You probably want a combination of both, since mod_rewriting to
another hostname always does a redirect ... Apache isn't going to
fetch that external URL for the browser, instead it tells the browser
to go there. Try this:
Alias /robots-default.txt /www/public/robots.txt
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule /robots.txt /robots-default.txt
_______________________________________________
UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net