簡體   English   中英

IIS重寫模塊中URL重定向中的異常將被忽略

[英]Exceptions in redirection in URL in IIS Rewrite module are ignored

我有一個新站點https://www.NewSite.com ,我希望所有到我舊站點https://www.OldSite.com的流量都重定向到我新站點https:// www的根目錄。 NewSite.com/ ,但有一些例外。

例如,我希望不要重定向URL(除其他外) https://www.OldSite.com/noredirect ,而要重寫其他URL。 例如:

因此,我在IIS的舊站點站點中編寫了兩個規則:

<rewrite>
<rules>
   <clear />
      <rule name="Rewrite To New Site" stopProcessing="true">
          <match url="/kb(.*)" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
          <action type="Rewrite" url="https://www.newsite.com/kb" />
      </rule>
      <rule name="Redirect to New Site" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{REQUEST_URI}" pattern="(.*)/noredirect$" negate="true" />
          </conditions>
          <action type="Redirect" url="https://www.newsite.com" appendQueryString="false" />
      </rule>
  </rules>
</rewrite>

此規則只是將對我的舊站點的所有請求重定向到新站點的根目錄,而忽略異常和重寫規則。 同樣的情況發生在:

<rule name="Redirect to New Site" stopProcessing="true">
              <match url="(.*)" />
              <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                <add input="{REQUEST_URI}" pattern="^/noredirect(.*)" negate="true" />
              </conditions>
              <action type="Redirect" url="https://www.newsite.com" appendQueryString="false" />
          </rule>

我究竟做錯了什么?

確保已選中“應用程序請求路由”緩存下的“啟用代理”。 您可以在這里找到有關它的一些信息: http : //www.iis.net/learn/extensions/configuring-application-request-routing-%28arr%29/creating-a-forward-proxy-using-application-request-路由

祝好運!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM