使用 HTACCESS 文件 添加吧,这是代码:
 
  Options +FollowSymLinks
  RewriteEngine on
  RewriteCond %{HTTP_HOST} ^domain.com[NC]
  RewriteRule ^(.*)$ http://www.Cuoxin.com/$1 [L,R=301]
  php写法:
 
  <?
  Header( "HTTP/1.1 301 Moved Permanently" );
  Header( "Location: www.Cuoxin.com" );
  ?>
  不带index.php文件:
 
  <?php
  $qurl = $_SERVER['REQUEST_URI'];
  //获取url,伪静态地址也能完整取得
  $qurl = str_replace("/index.php","",$qurl);
  if ($qurl!=""){
  header("HTTP/1.1 301 Moved Permanently");
  header("Location: http://www.Cuoxin.com");
  exit();}
  ?> 

301重定向代码 php apache

dawei

【声明】:达州站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。