IIS URL重写异常 [英] IIS URL rewrite exception
本文介绍了IIS URL重写异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前在IIS上有以下重写规则:
I have a this rewrite rule currently in place on 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
现在,是否可以创建一个例外,以便将特定页面重写为另一个扩展名?
Now, is it possible to create an exception so that a particular page rewrites to another extension?
site.com/exception-> site.com/exception.php
推荐答案
创建另一个规则,该规则位于具有匹配模式的'asp'规则之上:
Create another rule, which is above the 'asp' rule with match pattern:
<match url="^exception$|(.*/)exception$" />
和动作:
<action type="Rewrite" url="/{R:1}exception.php" />
这篇关于IIS URL重写异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文