判断搜索引擎来路进行跳转的代码
求大侠写个搜索引擎来路判断代码进行跳转
如果是百度来的 就跳到 http://aaaa.com
直接输入就不跳转
之前建过人写了代码但是不知道把代码放到那里
比如下面的
$RUrl = $_SERVER ['HTTP_REFERER'];
if (! empty ( $RUrl )) {
$UArray = parse_url ( $RUrl );
$UHost = $UArray ['host'];
switch ($UHost) {
case 'www.baidu.com' :
header ( "Location: http://aaa.com" );
break;
case 'www.google.com' :
header ( "Location: http://bbb.com" );
break;
case 'www.sogou.com' :
header ( "Location: http://ccc.com" );
break;
default :
echo $UHost;
break;
}
}
echo '直接輸入';
--------------------------------------------
和下面
章内容摘要:
PHP判断搜索引擎来路跳转代码: ?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') !==
PHP判断搜索引擎来路跳转代码:
<?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')