php实现301,404跳转

301跳转

<?php   
 $the_host = $_SERVER['HTTP_HOST'];
 $request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
 if($the_host !== 'www.jb51.net')
 {
     //echo $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: http://www.jb51.net' . $_SERVER['PHP_SELF']  . $request_uri);
 }
?>

404

<?php

header("HTTP/1.0 404 Not Found");

header("HTTP/1.0 404 Not Found");

?>

 

    A+
发布日期:2021年07月23日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: