mvc让无反斜杠的地址重定向都有反斜杠的地址

  <system.webServer>
    <!--如果想在路由器(RouteConfig)定义后缀.html那么需要加上下面代码-->
    <modules runAllManagedModulesForAllRequests="true" />
    <rewrite>
      <rules>
        <rule name="301_list" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAny">
            <add input="{URL}" pattern="/[a-z0-9-]+$" />
          </conditions>
          <action type="Redirect" url="http://{HTTP_HOST}/{R:0}/" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>

 

来源:中国建筑市场网

posted @ 2020-11-30 17:09  苦逼的猿人  阅读(105)  评论(0编辑  收藏  举报