When I’m about to start doing regular SEO, I still use the black link code, but it’s a little bit special. Of course, I’ll test it myself first to see if it’s feasible.
You need to create a PHP document to record whether the visitor is a spider or an ordinary user. Specifically, it is judged based on PHP's $_SERVER['HTTP_USER_AGENT']
The specific code is as follows:
$tmp = $_SERVER['HTTP_USER_AGENT'];
if(strpos($tmp, 'Googlebot') !== false){
echo 'Google';
} else if(strpos($tmp, 'Baiduspider') >0){
echo 'Baidu';
} else if(strpos($tmp, 'Yahoo! Slurp') !== false){
echo 'Yahoo';
} else if(strpos($tmp, 'msnbot') !== false){
echo 'Msn';
} else if(strpos($tmp, 'Sosospider') !== false){
echo 'soso';
} else if(strpos($tmp, 'YodaoBot') !== false || strpos($tmp, 'OutfoxBot') !== false){
echo 'Youdao';
} else if(strpos($tmp, 'Sogou web spider') !== false || strpos($tmp, 'Sogou Orion spider') !== false){
echo 'Sogou';
} 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';
}
?>
The following is from Baidu, of course, the above is also from Baidu. I am only responsible for the "pseudo-original" articles
www.2cto.com
$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: http://www.hao123.com" . $_SERVER['REQUEST_URI']);
// Automatically redirect to the corresponding webpage of http://www.hao123.com
// $_SERVER['REQUEST_URI'] is the path behind the domain name
// Or replace with header("Location: http://www.hao123.com/abc/d.php");
exit();
}
?>
Excerpted from http://www.xssxss.com/fuck/505.xss