I have the following re-write rule:
<rule name="machine-tools refine url with location"
stopProcessing="true">
<match
url="^(machine|construction|lifting|miscellaneous|woodworking)/([^/]+)/([^/]+)/(.*)$"
/>
<conditions trackAllCaptures="true">
<add input="{R:4}"
pattern="^(?:(new|used)(?:$|/))?([^/]*)?/?([^/]*)?/?((page)\d*)?/?" />
<add input="{States:{C:2}}" pattern="(.+)" />
</conditions>
<action type="Rewrite"
url="/pages/search.aspx?ind={R:1}&cat={R:2}&subcat={R:3}&loc={C:4}&manf={C:3}&cond={C:1}&pg={C:5}"
/>
</rule>
This rule sorta works. The problem is with the last bit in the input pattern: ((page\d*)
What i want is for there to be an optional parameter at the end of the url that will look like page#. I just need the # part, although if it returns page# that's fine as well as i can strip out the 'page' part.
This rule has some funky behavior.
If the url looks like /machine/cat/subcat/used/acme/page12
then pg=page
with a url of /machine/cat/subcat/used/page12 pg is blank, but manf=page12
and with a url of /machine/cat/subcat/page12 pg=page
Just for clarity, machine/cat/subcat will always be present - all other values are optional. There's also a 2nd rule which adds another parameter, location. But I think once i get this rule working i can modify the other one on my own.
This is being done in IIS express and will be deployed to an IIS 7/win2k8 r2 server and url rewrite v2
Thanks