404 错误截获失效链接重新定向

180it 2020-12-07 AM 176℃ 0条
<?php

$the_host = $_SERVER['HTTP_HOST']; 
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; 
//echo $the_host.PHP_EOL;
//echo $request_uri.PHP_EOL;

$request_uri=str_replace(".asp?","/?",$request_uri);
$request_uri=str_replace(".ASP?","/?",$request_uri);
$request_uri=str_replace("Show","show",$request_uri);
$request_uri=str_replace("SHOW","show",$request_uri);
$request_uri=str_replace("Id","id",$request_uri);
$request_uri=str_replace("ID","id",$request_uri);
$url='http://www.j8j9.com'.$request_uri;



//echo $url.PHP_EOL;


if(strpos($url,'show') !== false){ 
// echo '包含jb51'; 
//----------------------------------
if ($url) {
header('HTTP/1.1 301 Moved Permanently');//发出301头部
?>
<META HTTP-EQUIV="REFRESH" CONTENT="0; URL=<?=$url?>">
<?php
}
//----------------------------------
}else{
// echo '不包含jb51'; 
//----------------------------------
if ($url) {
header('HTTP/1.1 301 Moved Permanently');//发出301头部
?>
<META HTTP-EQUIV="REFRESH" CONTENT="0; URL=/">
<?php
}
//----------------------------------
}

?>
支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

404 错误截获失效链接重新定向