1.重定向tengmu.net到www.tengmu.net

这种重定向旨在使域名唯一,是网站SEO必须要做的,后面重定向www.tengmu.nettengmu.net也是出于同样的原因,只是形式不同。打开.htaccess文件,加入以下规则。(下面的规则是针对主域名的,子域名要修改)

  1. RewriteEngine On  
  2. RewriteCond %{HTTP_HOST} !^www.tengmu.net$ [NC]  
  3. RewriteRule ^(.*)$ http://www.tengmu.net/$1 [L,R=301

2.重定向www.domain.com到domain.com

  1. RewriteEngine On  
  2. RewriteCond %{HTTP_HOST} !^domain.com$ [NC]  
  3. RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301

3.重定向olddomain.com到www.newdomain.com

  1. RewriteEngine On  
  2. RewriteCond %{HTTP_HOST} !olddomain.com$ [NC]  
  3. RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301

 

4.重定向olddomain.com to newdomain.com

 

  1. RewriteEngine On  
  2. RewriteBase /  
  3. RewriteCond %{HTTP_HOST} !olddomain.com$ [NC]  
  4. RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301

5.重定向domain.com/file/file.php 到 otherdomain.com/ofile/ot.php

  1. RewriteCond %{HTTP_HOST} ^www.domain.com$  
  2. RewriteRule ^file/file.php$ http://www.otherdomain.com/ofile/ot.php [R=301,L] 

转载注明链接:http://www.hostloc.net/Article/301_htaccess01.aspx


本站网赚论坛
网站建设教程,seo教程,网站推广,网赚教程
用户交流群QQ:500人超级群:142791698 200人高级群:36121207

本日志由 eben 于 2011-09-12 19:13:37 发表,目前已经被浏览 200 次,评论 0 次;

作者添加了以下标签: 301seohtaccesslinu

引用通告:http://www.hacvk.com/Article/82/Trackback.ashx

评论订阅:http://www.hacvk.com/Article/82/Feeds.ashx

评论列表

    暂时没有评论
(必填)
(必填,不会被公开)
你的评论在博主审核后方可公开。