IIS URL重写例外
问题描述:
我在的地方目前在IIS上这个重写规则:IIS URL重写例外
<rewrite>
<rules>
<rule name="rewrite asp">
<!--Removes the .asp extension for all pages.-->
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" negate="true" pattern="(.*).asp" />
</conditions>
<action type="Rewrite" url="{R:1}.asp" />
</rule>
</rules>
</rewrite>
这使得这样的:
site.com/allpages - > site.com/allpages.asp
现在,是否有可能创建一个异常,以便一个特定的页面重写为另一个扩展?
site.com/exception - > site.com/exception.php
答
创建另一个规则,这是与匹配图案中的 'ASP' 规则以上:
<match url="^exception$|(.*/)exception$" />
和动作:
<action type="Rewrite" url="/{R:1}exception.php" />