繁体   English   中英

IIS重写模式不起作用

[英]IIS Rewrite pattern not working

我有一个无法使用的重写模式。

如果有人使用以下网址访问了我的网站:

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

我希望我的重写模式匹配querystring,然后将我的路径重写为

/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放入浏览器中,它会很好地显示。

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

<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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM