首页 > Web开发 > 详细

PHP实现301跳转

时间:2016-04-02 09:32:50      阅读:245      评论:0      收藏:0      [点我收藏+]

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中。

PHP实现301跳转

原文:http://www.cnblogs.com/izhengyang/p/5346914.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!