1
votes

Currently working with an external file for URL rewrites called rewritemaps.config (following these instructions), which works great. However, we have occasion to override an entry in that file with manual entries in web.config instead and they don't appear to work.

Specifically this issue has cropped up around the use of content experiments (A/B testing) with Google, which makes heavy use of querystrings in my URLs. The querystring takes the form of:

websiteurl.com/webpage1?utm_expid=########-#&utm_referrer=http%3A%2F%2Fwebsiteurl.com%2F

Now when attempting to validate my content experiment, I get the error

Web server rejects utm_expid. Your server doesn't support added query arguments in URLs.

...which is true for that particular URL because in the rewritemaps.config file we have this line:

<add key="/webpage1" value="/somefolder/file.aspx?id=18" />

The rewrite rule works fine but no amount of manual entries in web.config seem to work. If I comment out the line in rewritemaps.config and attempt to reach /webpage1, it errors with 404..which is expected. But I try to use manual entries in my web.config like:

<rule name="test rewrite" stopProcessing="true">
<match url="^(https?:\/\/)?websiteurl.com\/webpage1(.*)*" />
<action type="Rewrite" url="{R:1}/somefolder/file.aspx?id=18" appendQueryString="false" />
</rule>

I'm placing the rewrite rule before

<rewriteMaps configSource="rewritemaps.config" />

I've added query_string conditions, appendQueryString to true and to false, nothing is working even if I use wildcard patternSyntax, so it's leading me to believe that I can't manually add rewrite rules into the web.config if there is an external rewritemaps.config file.

Is this true? If so, how can I manually override a rewrite rule because I have to add the ability to allow a querystring in a rewrite?

1

1 Answers