簡體   English   中英

IIS的簡單URL重寫規則

[英]Simple URL rewrite rule for IIS

我需要一個用於IIS的簡單URL重寫規則。 如果該域后URL不包含"/i" ,我想添加它。

例如:

如果是www.abc.com/sample/test.aspx

我需要規則將其更改為:

www.abc.com/i/sample/test.aspx

您的規則應如下所示:

<rule name="prepend i">
    <match url=".*" />
    <conditions>
        <add input="{REQUEST_URI}" pattern="^/i/" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
   <action type="Redirect" url="/i/{R:0}" />
</rule>

暫無
暫無

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

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