如何在 IIS url rewrite (ASP NET Core) 中添加异常?
How add exception in IIS url rewrite (ASP NET Core)?
我有规则:
<rule name="main" stopProcessing="true">
<match url="main/([^.]*)/$" />
<action type="Redirect" url="/main/" appendQueryString="false" redirectType="Permanent" />
</rule>
参考文献 /main/xxxx/ 转到 /main/,但我需要使用一个参考文献 (/main/docs/) 制定规则,但没有重定向。
帮帮我,请在规则中进行例外处理
References /main/xxxx/ go to /main/, but I need make rule with one reference (/main/docs/) whitch doesn`t have redirect.
要达到要求,您可以尝试add a condition to the rule,如下所示。
<rule name="main" stopProcessing="true">
<match url="main/([^.]*)/$" />
<conditions>
<add input="{REQUEST_URI}" pattern="main/doc/" negate="true" />
</conditions>
<action type="Redirect" url="/main/" appendQueryString="false" redirectType="Permanent" />
</rule>
我有规则:
<rule name="main" stopProcessing="true">
<match url="main/([^.]*)/$" />
<action type="Redirect" url="/main/" appendQueryString="false" redirectType="Permanent" />
</rule>
参考文献 /main/xxxx/ 转到 /main/,但我需要使用一个参考文献 (/main/docs/) 制定规则,但没有重定向。
帮帮我,请在规则中进行例外处理
References /main/xxxx/ go to /main/, but I need make rule with one reference (/main/docs/) whitch doesn`t have redirect.
要达到要求,您可以尝试add a condition to the rule,如下所示。
<rule name="main" stopProcessing="true">
<match url="main/([^.]*)/$" />
<conditions>
<add input="{REQUEST_URI}" pattern="main/doc/" negate="true" />
</conditions>
<action type="Redirect" url="/main/" appendQueryString="false" redirectType="Permanent" />
</rule>