0
votes

I have a rewrite pattern that I can't get to work.

if someone goes to my site by using this url:

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

I would like my rewrite pattern to match the querystring and then rewrite my path to

/snapshots/snapshot_article_page_1.html

I tried writing a rule like this:

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

But I just keep getting a 404 error (even though the page exists!). I even tried actually putting in the full URL to the page and it doesn't work, but if I put the URL in the browser, it shows it fine.

1

1 Answers

0
votes

It appears I have done it. The rule to match my example would be this:

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