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

How Do I Pass Route Parameters via URL Rewriting if They Appear at the End of the Sting?

$
0
0

Hi,

I have a rewrite rule that passes parameters in the subdomain name to my application just fine but oddly never passes parameters that appear after the domain name in the URL.

<match url=".*" /><conditions><add input="{HTTP_HOST}" pattern="^(^$|[^\-]*)(^$|[\-]?)([^\-]\w)\.example\.com(.*)$" /><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /></conditions><action type="Rewrite" url="{ToLower:/folder/{C:3}{C:2}{C:1}{C:4}}" appendQueryString="true" /></rule>

I know the problem is not with the routing configuration because I have tested the routes without being rewritten and they work fine. This rule works great for something like http://city-state.example.com by passing city and state routevalues to ~/folder/state-city  but it never seems to pass anything from condition 4. As a result I get a 404 for stuff like http://city-state.example.com/category. My understanding of regex is that .* is a catch all that matches everything, so by having the condition set to (.*) that should catch everything after the m in .com but this does not seem to be passing anything at all. It should catch /category and add it to the rewritten URL.


Viewing all articles
Browse latest Browse all 2482

Trending Articles



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