0

I'm using the IIS Rewrite Module on IIS7.5. My mappings is in a text file in the structure:

[old url], [new url]

So something like this works:

products/abc, http://test.com/new/products/abc

This uses the following rule in my web.config

 <rule name="FileMapProviderRule" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{FileMapProvider:{R:1}}" pattern="(.+)" />
      </conditions>
      <action type="Redirect" url="{C:1}" redirectType="Permanent" />
 </rule>

What will my rule be if i want querystrings to be passed too? So i want this to work:

products?sku=123, http://test.com/new/products/123
products?sku=789, http://test.com/new/products/789
LordHits
  • 5,054
  • 3
  • 38
  • 51

1 Answers1

0

I solved this by the following rule:

<rule name="Products" patternSyntax="Wildcard" stopProcessing="true">
    <match url="products" />
    <conditions>
        <add input="{QUERY_STRING}" pattern="sku=*" />
    </conditions>
    <action type="Redirect" url="http://test.com/new/products/{C:1}" appendQueryString="false" redirectType="Permanent" />
</rule>
LordHits
  • 5,054
  • 3
  • 38
  • 51