【问题标题】:IIS URL Rewrite - any url request to redirect to a specific page without recursive rewritesIIS URL 重写 - 无需递归重写即可重定向到特定页面的任何 url 请求
【发布时间】:2012-06-16 12:59:35
【问题描述】:
<rule name="holdingPage" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
    <match url="^http://www.cruiseamour.co.uk/holding.php" negate="true" />
    <action type="Redirect" url="http://www.cruiseamour.co.uk/holding.php" appendQueryString="false" />
    <conditions></conditions>
</rule>

在对数据库进行一些维护时,我只是希望对页面(而不是保留页面)的任何请求都重定向到保留页面。目前规则是将保留页面的请求重定向到保留页面,导致递归循环,但我不知道为什么。

救命!!

【问题讨论】:

    标签: php url iis rewrite


    【解决方案1】:

    您在规则中的action 表示它应该重定向回自身,从而触发您所描述的递归行为。尝试将action 更改为:

    <action type="None" />
    

    这应该指定不需要任何操作并允许页面正常处理/执行。

    【讨论】:

    • 感谢 Liam,我需要应用该操作,但仅适用于保留页面 URL 以外的 URL。将操作更改为 none 不会重定向任何内容。
    • 您可以在全局重定向上方设置此规则,这将捕获并阻止重定向的发生。或者,您可以使用 RegEx 排除页面。我不在服务器前进行测试,但可能看起来像这样:^cruiseamour.co.uk/(?!holding\.php$).*?\.php
    【解决方案2】:

    我认为它比较的“url”在主机名后面的斜杠之后开始。所以在你的情况下,试试:&lt;match url="^holding.php" negate="true"/&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-11
      • 1970-01-01
      • 1970-01-01
      • 2018-11-29
      • 2016-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多