通过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>

 

相关文章:

  • 2023-04-08
  • 2021-09-01
  • 2021-10-18
  • 2022-03-10
猜你喜欢
  • 2021-11-09
  • 2022-12-23
  • 2021-12-20
  • 2021-07-26
  • 2022-12-23
  • 2021-05-17
相关资源
相似解决方案