[英]IIS URL rewrite to access subfolder content
是否可以創建將子文件夾的內容放在根目錄中的URL重寫?
例:
可以從/ article1到達/ pages / article1
可以從/ otherstuff到達/ pages / otherstuff
我不想使用虛擬目錄,因為我們正在談論/ pages文件夾中的數百個靜態頁面。
我自己找到了答案。
<rule name="RemoveSEOFolder" stopProcessing="true">
<match url="^seo$|^seo/(.*)$" />
<conditions>
</conditions>
<action type="Redirect" url="seo/{R:1}" />
</rule>
<rule name="RewriteToFile">
<match url="^(?!seo/)(.*)" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="seo/{R:1}" />
</rule>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.