使用htaccess apache重定向所有机器人

时间:2010-04-22 15:03:39

标签: apache .htaccess bots web-crawler

我应该使用什么.htaccess rewriterule来检测已知机器人,例如大机器人:

altavista,google,bing,yahoo

我知道我可以检查他们的ips或主机,但是有更好的方法吗?

1 个答案:

答案 0 :(得分:3)

RewriteCond %{HTTP_USER_AGENT} AltaVista [OR]
RewriteCond %{HTTP_USER_AGENT} Googlebot [OR]
RewriteCond %{HTTP_USER_AGENT} msnbot [OR]
RewriteCond %{HTTP_USER_AGENT} Slurp
RewriteRule ^.*$ IHateBots.html [L]