PHP 301跳转

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

posted @ 2012-11-21 22:40  象牛  阅读(215)  评论(0编辑  收藏  举报