Quantcast
Channel: URL Rewrite Module
Viewing all articles
Browse latest Browse all 2482

Wildcard for location pages

$
0
0

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=([^=&amp;]+)&amp;contentNameString=([^=&amp;]+)$" /></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}&amp;contentNameString={R:2}" /></rule>

Thank you for your help!

Amir


Viewing all articles
Browse latest Browse all 2482

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>