A8DOG

A8DOG

随便写写,记录折腾过程!
telegram

跳转屏蔽蜘蛛

<?php
//开启跳转 true  关闭跳转 false
$open = true;
//
$host = ['abc.com','2','3'];
//域名白名单
$new_jump = 'https://baidu.com'.$_SERVER['REQUEST_URI'];


$UA = ['Baiduspider','Googlebot','bingbot','Sosospider','Sosoimagespider','Bytespider','Sosospider','360Spider'];

for ($ii = 0; $ii < count($UA); $ii++) {
if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),strtolower($UA[$ii])) !== false) {
    $open = false;
}
}
$jump = true;
if ($open === true) {
    for ($i = 0; $i < count($host); $i++) {
    if (strtolower($host[$i]) === strtolower($_SERVER['SERVER_NAME'])) {
        $jump =false;
    }
}
}
if ($jump === true) {
    header("Location:$new_jump");
}

?>

index.zip

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.