IIS的简单URL重写规则
问题描述:
我需要一个适用于IIS的简单URL重写规则。如果URL不包括域名后面的"/i"
,我想补充一下。IIS的简单URL重写规则
例如:
如果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>