PHP实现301跳转
PHP实现301跳转的方法:
$theHost = $_SERVER['HTTP_HOST']; $theUrl = isset($_SERVER['REQUEST_URI'])? $_SERVER['REQUEST_URI']:''; $theUrl = strtolower($theUrl); if($theUrl == '/index.php') { $theUrl = ''; } if($theHost != 'www.test.com') { header('HTTP/1.1 301 Moved Permanently'); header('Location:http://www.test.com'.$the_url); }
将此代码放在*.php首行,或者放置在config.php中。
没有妹子的程序猿,不是好的设计师。。。

浙公网安备 33010602011771号