簡體   English   中英

IIS URL重寫以訪問子文件夾內容

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

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