Web.config配置301指定某个链接到指定链接
很多时候我们在给网站做调整的时候,就会遇到链接需要跳转的情况,这里我们就来分享一下常用的几种301跳转。
1、去掉网站首页后缀的index.html301写法
<rule name="去掉后缀index.html" stopProcessing="true">
<match url="^index.html" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://www.cdseoyh.cn" />
</rule>
2、不带www的跳转到带www的网址301写法
<rule name="www跳转" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^cdseoyh.cn$" />
</conditions>
<action type="Redirect" url="http://www.cdseoyh.cn/{R:0}" redirectType="Permanent" />
</rule>
3、指定某个页面跳转到首页的301写法
<rule name="指定页面301到首页" stopProcessing="true">
<match url="^m/$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://m.cdseoyh.cn/{R:1}"/>
</rule>
在3中,指定页面是http://www.cdseoyh.cn/m/跳转到http://m.cdseoyh.cn
版权保护: 本文由小冬SEO编辑发布,转载请保留链接: https://www.cdseoyh.cn/cms/dedesafe/74.html