【问题标题】:How to exclude URLs from IIS URL Rewrites when it contains an specific string当它包含特定字符串时,如何从 IIS URL 重写中排除 URL
【发布时间】:2021-09-18 17:25:42
【问题描述】:

我有以下网址:

http://localhost:4423/DXR.axd?r=1_84-0iUmm

还有以下 IIS 重写规则:

<rule name="Enforce LowerCase" enabled="true" stopProcessing="true">
  <match url="(.*)" />
  <conditions logicalGrouping="MatchAll" >
    <add input="{URL}" pattern="[A-Z]" ignoreCase="false" /> 
  </conditions>
  <action type="Redirect" url="{ToLower:{URL}}" redirectType="Permanent" />
</rule>

如果包含 DXR.axd,我将不适用该规则。你能分享你的想法吗?谢谢。

【问题讨论】:

  • 根据您的描述,我无法清楚地理解您的要求。你想重定向到哪个网址?
  • 我想排除任何包含 DXR.axd 的 URL。任何其他 url 都可以强制应用小写。

标签: iis url-rewriting url-rewrite-module


【解决方案1】:

HTTP 查询由协议、域、路径和查询字符串组成,您的 url 由 4 个离散元素构成:

  • 协议:http://
  • 域名:localhost:4423
  • 路径:/DXR.axd
  • 查询字符串:r=1_84-0iUmm

如果你想匹配任何没有/DXR.axd的字符串,你只需要这样设置你的参数:

<match url="^(?!/DXR.axd$).*$" />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-31
    • 2021-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多