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="/(.*)" /> </conditions> <action type="Rewrite" url="/index.php?title={C:1}" appendQueryString="true" /> </rule>
You then map to it with a back-reference to the condition.