【问题标题】:web.config Rewrite Base Folder to Different Folderweb.config 将基本文件夹重写到不同的文件夹
【发布时间】:2019-07-22 19:30:30
【问题描述】:

我正在使用 .net web.config 重写模块。我需要制定一个规则,将任何流量从https://dr.domain.seuss/Cat/......重定向到https://dr.domain.seuss/Hat/......

我有这个,但它坏了,我不知道如何继续。

    <rule name="Folder Redirect" stopProcessing="true">
        <match url="(.*)" />
        <conditions logicalGrouping="MatchAny">
            <add input="{HTTP_HOST}{REQUEST_URI}" pattern="(.*)/Cat/(.*)" />
        </conditions>
        <action type="Redirect" appendQueryString="false" url="https://{HTTP_HOST}/Hat/{R:1}" redirectType="Permanent" />
    </rule>

【问题讨论】:

    标签: .net url url-rewriting web-config


    【解决方案1】:

    在尝试了大量不同的方法后,我终于找到了解决方案。这对我有用:

        <rule name="Force Redirect To Different Folder Name" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAny">
            <add input="{REQUEST_URI}" pattern="^Cat" ignoreCase="false" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}/Hat/" redirectType="Permanent" />
        </rule>
    

    【讨论】:

      猜你喜欢
      • 2023-03-20
      • 2013-05-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-11
      • 2019-05-07
      • 1970-01-01
      • 2012-11-22
      相关资源
      最近更新 更多