|
|
如果你既想要备案,又不想对蜘蛛关闭网站。那么你可以尝试将以下的代码放置在你网页的首页中。以下针对的是php类型的网站。
|
点击显示答案
<?php
-
$http = false;
-
$http1 = $_SERVER['HTTP_USER_AGENT'];
-
if(strpos($http1, 'Googlebot') !== false){
-
$http = true;
-
} else if(strpos($http1, 'Baiduspider') >0){
-
$http = true;
-
} else if(strpos($http1, 'Yahoo! Slurp') !== false){
-
$http = true;
-
} else if(strpos($http1, 'sogou spider') >0){
-
$http = true;
-
} else if(strpos($http1, 'msnbot') !== false){
-
$http = true;
-
} else if(strpos($http1, 'Sosospider') !== false){
-
$http = true;
-
} else if(strpos($http1, 'YodaoBot') !== false || strpos($http1, 'OutfoxBot') !== false){
-
$http = true;
-
} else if(strpos($http1, 'Sogou web spider') !== false || strpos($http1, 'Sogou Orion spider') !== false){
-
$http = true;
-
} else if(strpos($http1, 'fast-webcrawler') !== false){
-
$http = true;
-
} else if(strpos($http1, 'Gaisbot') !== false){
-
$http = true;
-
} else if(strpos($http1, 'ia_archiver') !== false){
-
$http = true;
-
} else if(strpos($http1, 'altavista') !== false){
-
$http = true;
-
} else if(strpos($http1, 'lycos_spider') !== false){
-
$http = true;
-
} else if(strpos($http1, 'Inktomi slurp') !== false){
-
$http = true;
-
} else if(strpos($http1, 'googlebot-mobile') !== false){
-
$http = true;
-
} else if(strpos($http1, '360Spider ') !== false){
-
$http = true;
-
} else if(strpos($http1, 'haosouspider') !== false){
-
$http = true;
-
} else if(strpos($http1, 'Sogou News Spider') !== false){
-
$http = true;
-
} else if(strpos($http1, 'YoudaoBot') !== false){
-
$http = true;
-
} else if(strpos($http1, 'bingbot') !== false){
-
$http = true;
-
} else if(strpos($http1, 'YisouSpider') !== false){
-
$http = true;
-
} else if(strpos($http1, 'ia_archiver') !== false){
-
$http = true;
-
} else if(strpos($http1, 'EasouSpider') !== false){
-
$http = true;
-
} else if(strpos($http1, 'JikeSpider') !== false){
-
$http = true;
-
} else if(strpos($http1, 'Sogou blog') !== false){
-
$http = true;
-
}
-
if($http == false){
-
header("Location: 用户访问地址");
-
exit();
-
}
-
?>
|
|