[英]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.