PHP自用301强引蜘蛛代码,平时可能有的站做不起来,我们需要把蜘蛛强引到新站,这里66娱乐网刚好用到就写了一个php301蜘蛛代码,也分享给各位有缘的网友使用,下面代码以强引搜狗蜘蛛为例:
$key= $_SERVER["HTTP_USER_AGENT"];
$Sogouspider =preg_match('/Sogou web spider/', $key, $Sogouspider);
if($Sogouspider !='')
{
$host=$_SERVER['HTTP_HOST'];
$host=explode(".",$host);
$count_host=count($host);
if($count_host==3)
{
$host['0'].'.'.$host['2'];
$ym="http://".$host['0'].".8arg.com";
Header("HTTP/1.1 301 Moved Permanently");
Header("Location: $ym");
}
if($count_host==2)
{
$ym="http://8arg.com";
Header("HTTP/1.1 301 Moved Permanently");
Header("Location: $ym");
}
}转载请注明来自本站(66娱乐网)
66优乐网 » 个人自用的php301代码
66优乐网 » 个人自用的php301代码