网站目录改版,IIS web.config实现正规则批量301跳转方法

这个也是由于钟振森博客早期用的文章url比较长,现在需要改短url,所以用了这个方法来实现全面改版,现在把改版后的成功经验方法分享出来,希望帮助到跟钟振森博客改版需要的站长朋友。

网站改URL之前需要先写好定向规则:

以上的一小段改版规则代码方法:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/404.shtml" responseMode="ExecuteURL" />
</httpErrors>
<rewrite>

<rules>
<rule name="Redirect" stopProcessing="true">
<match url="^https://test.com/seo/2008/03/06/1.html" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="https://test.com/1.html" />
</rule>

<rules>
<rule name="Redirect2" stopProcessing="true">
<match url="^https://test.com/seo/2008/03/06/1.html" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="https://test.com/1.html" />
</rule>
	
	
<rules>
<rule name="Redirect3" stopProcessing="true">
<match url="^https://test.com/seo/2008/03/06/1.html" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="https://test.com/1.html" />
</rule>
	
<rules>
<rule name="Redirect4" stopProcessing="true">
<match url="^https://test.com/seo/2008/03/06/1.html" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="https://test.com/1.html" />
</rule>
	
<rules>
<rule name="Redirect5" stopProcessing="true">
<match url="^https://test.com/seo/2008/03/06/1.html" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="https://test.com/1.html" />
</rule>
	
<rules>
<rule name="Redirect6" stopProcessing="true">
<match url="^https://test.com/seo/2008/03/06/1.html" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="https://test.com/1.html" />
</rule>

	</rules>
</rewrite>
</system.webServer>
</configuration>

有多少链接需要改版的,就写多少相对应的URL即可,改好301定规则之前,别忘记了去百度站长工具增加一下修改规则。

不懂怎么增加百度改版规则的可以看一下以下这篇文章: 网站改版百度站长工具规则方法

来源:钟振森博客,欢迎分享(QQ/微信:209160688)