LoadModule alias_module modules/mod_alias.so
<Location "/robots.txt">
SetHandler None
</Location>
alias /robots.txt /var/www/html/robots.txt
If you don’t add mod_alias, you’ll get an error saying that the
keyword “alias” is a misspelling or is not supported by Apache. I use
“<Location>” here instead of “<File>” or “<Directory>”
because I’m applying the rule only to incoming requests for
“/robots.txt” explicitly, and it isn’t likely that I’ll have more than
one way of reaching that file, since I’m not aware of engines that look
for robots.txt in some other way. <Directory> applies rules to an
entire directory and its subdirectories, and <File> applies rules
to a file on disk so the rules will apply even if there’s more than one
URL that maps to the file.
Arun is a JAVA/J2EE developer and passionate about coding and managing technical team.
0 comments:
Post a Comment