用于处理所有URL(给定URL除外)的IIS重写规则
以下是一些URL要处理的IIS重写规则:用于处理所有URL(给定URL除外)的IIS重写规则,iis,url-rewriting,Iis,Url Rewriting,以下是一些URL要处理的IIS重写规则: <rule name="rule" stopProcessing="true"> <match url="^(word|world|hero|about)[/]?$" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <a
<rule name="rule" stopProcessing="true">
<match url="^(word|world|hero|about)[/]?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/info.aspx?id={R:1}" />
</rule>
如何创建相反的规则?例如,我想处理除“/special”和“/escape”之外的所有URL。这:
不起作用。“/special”和“/escape”URL按其应有的方式进行处理,但其他URL为我提供404页。在这种情况下,您必须使用
否定属性
您的规则将成为:
<rule name="rule" stopProcessing="true">
<match url="^(special|escape)/?$" negate="true" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/info.aspx?id={R:1}" />
</rule>
<rule name="rule" stopProcessing="true">
<match url="^(special|escape)/?$" negate="true" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/info.aspx?id={R:1}" />
</rule>