Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 migrating from IIS6 with ISAPI_Rewrite to IIS7 using their Rewrite module. I have a "pretty" url that looks like this: /Shop/Q%26A. Of course that it Q&A encoded. IIS7 doesn't seem to like it. Any ideas?

I already set doubleEscaping=true because I use '+' instead of '%20' for spaces. I can't seem to find anything online about this.

share|improve this question
up vote 1 down vote accepted

Wow, it just so happens that Ruslan from the IIS team has been helping me with an almost identical problem over the last two days.

IIS (HTTP.sys) will parse your URL for you - for example, http://site///////dir////file serves you the same content as http://site/dir/file. It will leave the query string alone, but at this point, as we are using pretty URLs, the value is not yet in the query string!

The unencoded URL is stored in a server variable named UNENCODED_URL. You can do something like this to get that value into a capture variable:

<rule name="something" stopProcessing="true">
    <match url=".*" ignoreCase="false" />
    <conditions logicalGrouping="MatchAll">
        <add input="{URL}" negate="true" pattern="^/index\.php" ignoreCase="false" />
        <add input="{QUERY_STRING}" pattern="^$" ignoreCase="false" />
        <add input="{UNENCODED_URL}" pattern="/(.*)" />
    <action type="Rewrite" url="/index.php?title={C:1}" appendQueryString="true" />

You then map to it with a back-reference to the condition.

share|improve this answer
That worked perfectly! – user11067 Jun 29 '09 at 20:56

Your Answer


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