[英]IIS URL Rewrite Module root directory mapping
我在IIS 8上使用URL重寫模塊。
我希望能夠將所有對* .archive的調用映射到使用以下代碼工作的頁面處理程序
<rule name="Redirect .archive extension" stopProcessing="true">
<match url="^(.*).archive" ignoreCase="true" />
<conditions logicalGrouping="MatchAny">
<add input="{URL}" pattern="(.*).archive$" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="PageHandler.ashx?path={C:1}" />
</rule>
我現在需要將對目錄/路徑的調用映射到未指定默認文件的同一處理程序,例如
https://www.example.com
https://www.example.com/images
https://www.example.com/images/
有沒有人有任何關於如何實現上述目標並保持存檔規則的示例?
謝謝馬克
您可以使用以下重寫規則:
<rule name="Redirect .archive extension" stopProcessing="true">
<match url="www.sample1.com/(.*)" ignoreCase="true" negate="true" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_URI}" pattern="(.*)" />
</conditions>
<action type="Rewrite" url="page1.html?path={C:1}" appendQueryString="false" logRewrittenUrl="true" />
</rule>
注意:根據您的要求修改主機名並重寫url。
此致賈爾帕
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.