微信客服微信客服

通过web.config文件设置301跳转方法

阅读:1.69万 评论:0 点赞:1 2020-03-21

设置方法

用记事本打开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>

代码截图

用户评论(0)
取消回复
无有评论,您来说说!

电话:15561532279 Q Q :251443403
周一至周五(早8:00 - 晚6:00)
2000人站长群:176381403
VIP QQ群:196313294
Copyright © 2008-2024 框分类信息系统  版权所有    ICP证:黑ICP备19004589号     黑公网安备 23090402000014号
本系统由七台河市广盛网络科技有限公司开发 专业地方同城分类信息源码