通过Web.config实现301重定向
IIS7以上可以通过修改Web.config实现IIS设置
现在我们通过Web.config实现301重定向
<system.webServer> <validation validateIntegratedModeConfiguration="false" /> <modules runAllManagedModulesForAllRequests="true" /> <security> <requestFiltering allowDoubleEscaping="true" /> </security> <rewrite> <rules> <rule name="301Redirect" stopProcessing="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAny"> <add input="{HTTP_HOST}" pattern="^hantianwei\.com$" /> <add input="{HTTP_HOST}" pattern="^www\.hantianwei\.com$" /> </conditions> <action type="Redirect" url="http://www.hantianwei.cn/{R:0}" redirectType="Permanent" /> </rule> </rules> </rewrite> </system.webServer>