Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

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

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

1 Answer 1

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

 
discard

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.