问题
What .htaccess rewriterule should i use to detect known bots, for example the big ones:
altavista, google, bing, yahoo
I know i can check for their ips, or hosts, but is there a better way?
回答1:
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]
来源:https://stackoverflow.com/questions/2691956/redirect-all-bots-using-htaccess-apache