2015-10-15 77 views
0

我有一个重写模式,我无法工作。IIS重写模式不起作用

,如果有人使用这个网址去我的网站:

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放到浏览器中,它就会显示出来。

回答

0

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

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