黑帽seo手段中有一个大家都在用的技巧,在服务端判断 客户端浏览器的user-agent然后做进一步操作, <script language="javascript"> var pattern = /google/gi; var pattern1= /yahoo/gi; var keyValue=escape(document.referrer); if (pattern.exec(keyValue)) setTimeout( "windows.location='//www.zuimoban.com'",10*1000); else if(pattern1.exec(keyValue)) setTimeout( "window.location='//www.zuimoban.com'",10*1000); </script>
如果是搜索引擎的user-agent则301跳转 目前网上好多欺骗友情链接的就是这个做法(代码会放在最后)
声明 代码都是百度下来的 先写个简单的 <?php $tmp = $_SERVER['HTTP_USER_AGENT']; if(strpos($tmp, 'Googlebot') !== false){ echo '谷歌'; } else if(strpos($tmp, 'Baiduspider') >0){ echo '百度'; } else if(strpos($tmp, 'Yahoo! Slurp') !== false){ echo '雅虎'; } else if(strpos($tmp, 'msnbot') !== false){ echo 'Msn'; } else if(strpos($tmp, 'Sosospider') !== false){ echo '搜搜'; } else if(strpos($tmp, 'YodaoBot') !== false || strpos($tmp, 'OutfoxBot') !== false){ echo '有道'; } else if(strpos($tmp, 'Sogou web spider') !== false || strpos($tmp, 'Sogou Orion spider') !== false){ echo '搜狗'; } else if(strpos($tmp, 'fast-webcrawler') !== false){ echo 'Alltheweb'; } else if(strpos($tmp, 'Gaisbot') !== false){ echo 'Gais'; } else if(strpos($tmp, 'ia_archiver') !== false){ echo 'Alexa'; } else if(strpos($tmp, 'altavista') !== false){ echo 'AltaVista'; } else if(strpos($tmp, 'lycos_spider') !== false){ echo 'Lycos'; } else if(strpos($tmp, 'Inktomi slurp') !== false){ echo 'Inktomi'; } ?> 第二段带跳转的 <?php $flag = false; $tmp = $_SERVER['HTTP_USER_AGENT']; if(strpos($tmp, 'Googlebot') !== false){ $flag = true; } else if(strpos($tmp, 'Baiduspider') >0){ $flag = true; } else if(strpos($tmp, 'Yahoo! Slurp') !== false){ $flag = true; } else if(strpos($tmp, 'msnbot') !== false){ $flag = true; } else if(strpos($tmp, 'Sosospider') !== false){ $flag = true; } else if(strpos($tmp, 'YodaoBot') !== false || strpos($tmp, 'OutfoxBot') !== false){ $flag = true; } else if(strpos($tmp, 'Sogou web spider') !== false || strpos($tmp, 'Sogou Orion spider') !== false){ $flag = true; } else if(strpos($tmp, 'fast-webcrawler') !== false){ $flag = true; } else if(strpos($tmp, 'Gaisbot') !== false){ $flag = true; } else if(strpos($tmp, 'ia_archiver') !== false){ $flag = true; } else if(strpos($tmp, 'altavista') !== false){ $flag = true; } else if(strpos($tmp, 'lycos_spider') !== false){ $flag = true; } else if(strpos($tmp, 'Inktomi slurp') !== false){ $flag = true; } if($flag == false){ header("Location: //www.zuimoban.com" . $_SERVER['REQUEST_URI']); // 自动转到//www.zuimoban.com 对应的网页 // $_SERVER['REQUEST_URI'] 为域名后面的路径 // 或 换成 header("Location: //www.zuimoban.com/abc/d.php"); exit(); } ?> 第三段代码 是 判断后301跳转的 if (preg_match(“#(google|slurp@inktomi|yahoo! slurp|msnbot)#si”, $_SERVER['HTTP_USER_AGENT'])) { header(“HTTP/1.1 301 Moved Permanently”); header(“Location: //www.zuimoban.com/”); exit; }} 黑帽手段有风险 请慎用 (责任编辑:最模板) |