漫步浪尖

记载Xhtml,Css,Javascript,W3c,Seo,计算机,服务器等Web技术相关的心得.

Javascript标签到底改不改使用language去Zblog列表插件链接标题的title

Php的301重定向代码

一:更推荐这种方法,因为它可以把www.qqcampus.org原来所有的url都转到qqcampus.org新的地址上
<?php
 $the_host = $_SERVER['HTTP_HOST'];
 $request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
 if($the_host == 'www.qqcampus.org')
 {
  header('HTTP/1.1 301 Moved Permanently');
  header('Location: http://qqcampus.org'.$request_uri);//
 }
?>

二:单页多站的Php301重定向代码,www.fend.cn和fend.cn则301到index.php上,www.qqcampus.org则301到qqcampus.org上,否则转到错误页
<?php
 if(($HTTP_HOST=="www.fend.cn")or($HTTP_HOST=="fend.cn"))
  {
   header("HTTP/1.1 301 Moved Permanently");
   Header("Location: /index.php");
  }
 elseif($HTTP_HOST=="www.qqcampus.org")
  {
   header("HTTP/1.1 301 Moved Permanently");
   Header("Location: http://qqcampus.org");
  }
 else
  {
   Header("Location: /404.htm");
  }
?>

网摘:

评论Php的301重定向代码:

GlobeTour欢迎您参与讨论,请在这里发表您的看法、交流您的观点。

Php的301重定向代码 Powered By Z-Blog 漫步浪尖