Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm struggling with a legacy app that uses special characters like %26 in the URL. The characters don't affect the app but can't be changed, so I'm trying to get IIS to deal with them.

I've tried to ignore them using multiple methods, but nothing seems to work.

So now I installed the IIS rewrite module and added a rewrite rule to web.config to replace the characters %26 with _, for example:

        <rule name="ampersand" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*%26*" />
            <action type="Redirect" url="{R:1}_{R:2}" />

The problem is that IIS responds with "Bad Request" before the rewrite rule ever gets called. So my question is this: how can I change the order of precedence so that the mod rewrite filter will be called before IIS puts the ban hammer down on that URL?

share|improve this question

try changing the rule to:

<match url="(.*)%26(.*)" />
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.