http://topic.csdn.net/u/20111012/23/274cb7b7-4310-4f40-aa6b-69fcce4739f4.html?3456
其实robots.txt也不是百分之百的可以阻止蜘蛛爬行你的网站,我自己结合某些资料写了一小段代码,貌似可以彻底解决这个问题,不对的地方请大家多多指教:
PHP code
if
(
preg_match
(
"
/(Googlebot|Msnbot|YodaoBot|Sosospider|baiduspider|google|baidu|yahoo|sogou|bing|coodir|soso|youdao|zhongsou|slurp|ia_archiver|scooter|spider|webcrawler|OutfoxBot)/i
"
,
$_SERVER
[
'
HTTP_USER_AGENT
'
])) {
header
(
'
HTTP/1.1 403 Forbidden
'
);
exit
; }