0

Please I am just starting off with using iis rewrite module and I have a task to rewrite a url with querystring.

What I have to do is rewrite this url http://www.blah.com/Pages/Content.aspx?id=n%2fWA2PJCJXXnu8mvdC0jXQ%3d%3d&ln=Gy7UlI4cSJE94Wa2qudbFQ%3d%3d

to something like this http://www.blah.com/Pages/Content.aspx?id=Ecommerce

Hello Mathew thanks for the link, however I am not really up to speed with url rewrite module I have come with this and it doesn't seem to be working

<rules>
    <rule name="QueryStringRW" stopProcessing="true">
        <match url="^Content\.aspx$" ignoreCase="true" />
        <conditions>
            <add input="{QUERY_STRING}" pattern="id=(\d+)" />
            <add input="{IDtoTitleMap:{C:1}}" pattern="(.+)" />
        </conditions>
        <action type="Redirect" url="Content.aspx?id={C:1}" appendQueryString="false" redirectType="Permanent"/>
    </rule>
</rules>
<rewriteMaps>
    <rewriteMap name="IDtoTitleMap">
        <add key="id=n%2fWA2PJCJXXnu8mvdC0jXQ%3d%3d&ln=Gy7UlI4cSJE94Wa2qudbFQ%3d%3d" value="Id=Ecommerce" />
    </rewriteMap>
</rewriteMaps>
Rob
  • 4,927
  • 12
  • 49
  • 54
user989865
  • 627
  • 3
  • 9
  • 25

1 Answers1

0

A rewrite rule requires the following pieces of information:

  • Name of the rule
  • Pattern to use for matching the URL string
  • Optional set of conditions
  • Action to perform if a pattern is matched

A detailed approach on how to creating rules for the URL Rewrite Module is available at: http://learn.iis.net/page.aspx/461/creating-rewrite-rules-for-the-url-rewrite-module/

Anil Mathew
  • 2,590
  • 1
  • 15
  • 15
  • Hello Mathew thanks for the link, however I am not really up to speed with url rewrite module I have come with this and it doesn't seem to be working – user989865 Apr 15 '12 at 13:05