Regex – URL Rewrite 2.0 Wildcards – IIS 7.5

iis-7.5regexurl-rewriting

<rule name="WomensSilverBangles" patternSyntax="ExactMatch">
    <match url="/Bangles/Silver/Womens.aspx" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
    <action type="Rewrite" url="Collections/jewellery.aspx?AXSW_CategoryID=Bangles&amp;AXSWFinenessId=Silver&amp;AXSW_GenderID=Womens&amp;MenuName=Jewellery&amp;SiteMapNode=Silver Bangles&amp;depth=2" />
</rule>

Can this be written using wildcards?

As you can see, the three variables in the match URL are used in the rewritten URL string.

Best Solution

I know it's been a while since this question was posted, but there is an excellent article on rewriting here and based on that, you could try experimenting with something like this(not tested):

    <rule name="3levelcatchall" patternSyntax="Wildcard">
      <match url="/*/*/*.aspx"/>
      <action type="Rewrite" url="Collections/jewellery.aspx?AXSW_CategoryID={R:1}&amp;AXSWFinenessId={R:2}&amp;AXSW_GenderID={R:3}&amp;MenuName=Jewellery&amp;SiteMapNode={R:2} {R:1}&amp;depth=2" appendQueryString="false"/>
    </rule>
Related Question