I'm running MAMP 2.1.3 (latest version) as a local development server. Apart from a few MySQL databases and a custom document root, it's as vanilla and untampered as it gets. The server runs fine until I try the following.

The server can be reached via dyndns, so I'd like to block search engines from accessing it. I've created an .htaccess file in my document root with the following lines:

User-agent: * 
Disallow: /

Pretty simple and I've used this in the past on other systems without any problems. For some reason, however, Apache is throwing a 500 Internal Server Error. My Apache error log says:

[alert] [client 127.0.0.1] /Users/jerry/Sites/.htaccess:
Invalid command 'User-agent:', perhaps misspelled or defined
by a module not included in the server configuration

(line breaks added manually)

I can't see any typos and I've tried to Google around to figure out what module might be missing (shouldn't this be pretty standard stuff?) but I can't find anything of use. Can anyone help?

有帮助吗?

解决方案

Putting those lines in .htaccess is a mistake.

This code goes into your DOCUMENT_ROOT/robots.txt:

User-agent: * 
Disallow: /
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top