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 trying to rewrite in IIS 7.5 from an old website to the new one. We have a list of URL's with and without query strings.

I can get the URL's without query strings to redirect but not with.

    <rewriteMaps configSource="rewritemaps.config" />
    <rule name="Redirect Rule" stopProcessing="true">
      <match url=".*" ignoreCase="false" />
        <add input="{StaticRedirects:{URL}}" pattern="(.+)" />
      <action type="Redirect" url="{C:1}" appendQueryString="false" redirectType="Permanent" />

this is the sample rewritemap:

  • add key="/boat-insurance/canoe.aspx" value="/boat/canoe-insurance" (this works)
  • add key="/boat-insurance/canoe/details.aspx?#details" value="/boat/canoe-insurance" (this does not)
share|improve this question

It's possible to rewrite based on the query string (everything behind the ?) but the #details is NOT part of the query string. It's what is called the fragment identifier and it's a client-only part of the URL. The browser never sends that to the server so it's impossible for the server to use that for URL rewriting.

share|improve this answer
Thanks Marco, i could get the query string part to rewrite but the #details part was driving me up the wall !! Thanks for the pointer. – Ian Houghton Dec 14 '12 at 8:52

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.