我该如何创建强制使用小写 URL 的 URL 重写规则,除非请求是 AJAX 请求,即 header X-Requested-With 的值为 XMLHttpRequest 时?
最佳答案
想通了。
<rule name="LowerCaseURL" stopProcessing="true">
<match url="[A-Z]" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_X_Requested_With}" pattern="^XMLHttpRequest$" negate="true" />
</conditions>
<action type="Redirect" url="{ToLower:{URL}}" />
</rule>
关于忽略 AJAX 请求的 ASP.NET URL 重写规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27085984/