設(shè)置方法
用記事本打開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>
這樣設(shè)置后,就把qthxxw.com跳轉(zhuǎn)到www.qthxxw.com
可以在<rules>后插入多段這樣的代碼,來實(shí)現(xiàn)跳轉(zhuǎn)
注意:
這個(gè)名字不能有重復(fù)的,
下面的例子是設(shè)置兩個(gè)跳轉(zhuǎn)規(guī)則
301Redirect01和301Redirect02
301Redirect01設(shè)置了qthxxw.com 跳轉(zhuǎn)到 www.qthxxw.com
301Redirect02設(shè)置了www.qth8.com 跳轉(zhuǎn)到 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>
代碼截圖