【问题标题】:IIS URL Rewrite - ignore if URL containsIIS URL 重写 - 如果 URL 包含,则忽略
【发布时间】:2015-09-18 19:48:44
【问题描述】:

我在 web.config 中有以下 URL 重写设置,可以按我的意愿工作。

<rule name="Product Rewrite" stopProcessing="true">
  <match url="^products/([^$]+)/([^$]+)" />
  <action type="Rewrite" url="products?durl={R:1}&amp;purl={R:2}" />
</rule>

现在我需要排除任何包含或以 /action/edit 结尾的网址,即 products/action/edit

我知道我需要一个条件块,但我不确定要写什么。

任何帮助将不胜感激。

【问题讨论】:

    标签: asp.net url-rewriting webforms


    【解决方案1】:

    添加如下条件,否定 true 确保它匹配除操作/编辑之外的所有内容

    <conditions>
     <add input="{URL}" negate="true" pattern="action/edit" />
    </conditions>
    

    【讨论】:

      猜你喜欢
      • 2014-11-30
      • 2019-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-17
      • 1970-01-01
      • 1970-01-01
      • 2018-11-13
      相关资源
      最近更新 更多