簡體   English   中英

URL重寫:使用不存在的路徑重寫URL

[英]URL Rewrite: Rewrite URL with unexisting Path

我目前有一個網址:

http://someDomain.com/SomeVirtualDirectory/SomeDb/SomeFileID

我很樂意重寫為

http://someDomain.com/SomeVirtualDirectory/Get.aspx?page={REQUEST_URI}" 

我目前使用以下Inbound Rule

        <rule name="CatchAll" stopProcessing="true">
          <match url=".*" />
          <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Redirect" url="http://someDomain.com/SomeVirtualDirectory/Get.aspx?page={REQUEST_URI}" logRewrittenUrl="true" />
        </rule>>

我注意到似乎沒有發生重寫(使用Fiddler等...)。 是否知道如果服務器上不存在路徑(在這種情況下為SomeDb/SomeFileID是否可以使用URL Rewrite

謝謝您的時間,祝您周末愉快

幸運地找到了解決方案:

        <rule name="CatchAll" stopProcessing="false">
          <match url=".*" />
          <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="Get.aspx?page={R:0}" logRewrittenUrl="true" />
        </rule>

我希望這對某人有幫助。 Rewrite不起作用的主要原因是因為我將StopProcessing設置為true。

暫無
暫無

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

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