2016-10-05 109 views
0

我需要一個適用於IIS的簡單URL重寫規則。如果URL不包括域名後面的"/i",我想補充一下。IIS的簡單URL重寫規則

例如:

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

我需要的規則,將其更改爲:

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

回答

0

你的規則應該是這樣的:

<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>