设置方法
用记事本打开web.config文件
找到<rules>
在他后面插入
<rule name="301Redirect01" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^qthxxw.com$" />
</conditions>
<action type="Redirect" url="http://www.qthxxw.com/{R:0}" redirectType="Permanent" />
</rule>
这样设置后,就把qthxxw.com跳转到www.qthxxw.com
可以在<rules>后插入多段这样的代码,来实现跳转
注意:
这个名字不能有重复的,
下面的例子是设置两个跳转规则
301Redirect01和301Redirect02
301Redirect01设置了qthxxw.com 跳转到 www.qthxxw.com
301Redirect02设置了www.qth8.com 跳转到 www.qthxxw.com
<rule name="301Redirect01" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^qthxxw.com$" />
</conditions>
<action type="Redirect" url="http://www.qthxxw.com/{R:0}" redirectType="Permanent" />
</rule>
<rule name="301Redirect02" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.qth8.com$" />
</conditions>
<action type="Redirect" url="http://www.qthxxw.com/{R:0}" redirectType="Permanent" />
</rule>
代码截图