【问题标题】:URL Rewriting (IIS) - how to represent an url pattern in match tagURL 重写 (IIS) - 如何在匹配标记中表示 url 模式
【发布时间】:2012-11-05 21:36:40
【问题描述】:

我的 IIS 7 服务器有一个 url 重写规则,如下所示:

<rewrite>
    <rules>
      <rule name="topcontent">
           <match url=".*">
                <action type="rewrite" url="mysite.com/{R:0}"/>
           </match>
       </rule>
    </rules>
</rewrite>

现在我必须为特定位置提供此规则的例外情况,即 'http://tempurl94.goto.com/?q=x&m=y' where 'http://tempurl94.goto.com '将永远存在 在 url 中,查询参数 q 和 m 可能会有所不同。所以我们必须为 这个网址。怎么写不同(匹配url=?)。

也许我可以在“topcontent”规则之前写一条规则并说stopProcessing='true'。 但我需要知道我应该在&lt;match url=' ? '&gt; 中写什么以及我应该在&lt;action&gt; 标签中写什么。

【问题讨论】:

    标签: iis iis-7 url-rewriting iis-6


    【解决方案1】:

    您需要将conditions 元素添加到新规则中。将新规则放在当前规则之前,并将stopProcessing 设置为true,如您所述。

    <conditions>
        <add input="{HTTP_HOST}" pattern="^tempurl94\.goto\.com$" />
    </conditions>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-11-18
      • 2013-01-21
      • 2011-01-14
      • 2011-01-23
      • 2022-11-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多