Hi, I have the following redirect to turn query strings into friendly urls for a series of location pages with unique names. This redirect works perfectly when the location, in this example "name-of-location-page", is hard coded but I cannot seem to find a way to pass through the location name from the match to the action with a wildcard. Any ideas?
Code here:
<rule name="RedirectUserFriendlyURL1" stopProcessing="true"><match url="^locations/name-of-location-page/$" /><conditions><add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" /><add input="{QUERY_STRING}" pattern="^contentIdString=([^=&]+)&contentNameString=([^=&]+)$" /></conditions><action type="Redirect" url="locations/name-of-location-page/{C:1}/{C:2}" appendQueryString="false" /></rule><rule name="RewriteUserFriendlyURL1" stopProcessing="true"><match url="^locations/name-of-location-page/([^/]+)/([^/]+)/?$" /><conditions><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /></conditions><action type="Rewrite" url="locations/name-of-location-page/?contentIdString={R:1}&contentNameString={R:2}" /></rule>
Thank you for your help!
Amir