toxic

备忘录

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

     能用的iis7 301跳转

index301.htaccess 必须写到.htaccess后缀的文件里,
1.在iis7的URL Rewrite中右侧点击Import Rules导入.htaccess文件
把henghengw.com 跳转到www.henghengw.com其他链接不跳转

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^henghengw.com$ [NC]
RewriteRule ^(.*)$http://www.henghengw.com/$1[R=301,L]
</IfModule>

其实应该也可以试试直接在web.config里写规则

<rule name="index301" stopProcessing="true">
          <match url="^(.*)$" ignoreCase="false" />
          <conditions logicalGrouping="MatchAll">
            <add input="{HTTP_HOST}" pattern="^henghengw.com$" />
          </conditions>
          <action type="Redirect" url="http://www.henghengw.com/{R:1}" redirectType="Permanent" />
        </rule>

posted on 2012-08-13 15:53  toxic  阅读(492)  评论(0)    收藏  举报