我目前在IIS上有一个重写规则:
<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/exclusion.php
创建另一个规则,该规则位于匹配模式为的"asp"规则之上
<match url="^exception$|(.*/)exception$" />
和动作:
<action type="Rewrite" url="/{R:1}exception.php" />