【问题标题】:IIS Rewrite pattern not workingIIS 重写模式不起作用
【发布时间】:2015-10-15 18:38:19
【问题描述】:

我有一个无法开始工作的重写模式。

如果有人使用此网址访问我的网站:

http://example.com/article/page/1?_escaped_fragment_=

我希望我的重写模式匹配查询字符串,然后重写我的路径

/snapshots/snapshot_article_page_1.html

我试着写一个这样的规则:

    <rule name="Seo rewrite rule" stopProcessing="true">
      <match url="(.*)"/>
      <conditions>
        <add input="{QUERY_STRING}" pattern="(.*)_escaped_fragment_=(.*)" />
      </conditions>
      <action type="Rewrite" url="/assets/snapshots/snapshot__{REQUEST_URI}.html" appendQueryString="false" />
    </rule>

但我只是不断收到 404 错误(即使该页面存在!)。我什至尝试实际将完整的 URL 放入页面,但它不起作用,但如果我将 URL 放入浏览器中,它显示它很好。

【问题讨论】:

    标签: iis url-rewriting


    【解决方案1】:

    看来我已经做到了。 匹配我的例子的规则是这样的:

    <rule name="Seo rewrite rule" stopProcessing="true">
      <match url="(.*)"/>
      <conditions>
        <add input="{QUERY_STRING}" pattern="(.*)_escaped_fragment_=(.*)" />
      </conditions>
      <action type="Rewrite" url="/assets/snapshots/snapshot__{R:0}.html" appendQueryString="false" />
    </rule>
    

    【讨论】:

      猜你喜欢
      • 2011-08-04
      • 1970-01-01
      • 2013-02-27
      • 2013-07-26
      • 1970-01-01
      • 2015-01-29
      • 2014-09-20
      • 2014-08-02
      相关资源
      最近更新 更多