6

I'm struggling to find any information on how best to handle URLs with anchor tags, like the #foo in www.example.com/index.html#foo

Our current situation is trying to use a Rewrite map for a URL with an anchor tag, but it is being trumped by another Rewrite mapping.

e.g.

 <add key="index.html#foo" value="bar1.html" />
 <add key="index.html" value="bar2.html" />

 <!-- A request to index.html#foo is being redirected to bar2.html, 
      not bar1.html as expected -->

Does URL Rewrite include this in the URL? Or is available via one of the variables? Is there documentation on this?

(I've also tried searching on "fragment identifier", "#" "hash" "hash tag")

Spongeboy
  • 2,232
  • 3
  • 28
  • 37
  • I'm hitting something similar now and I'd like an idea as to what is up, but the most I have found out so far is that IE thinks that the # when sent is a scripting tag so it gets eliminated in the send. Or something like that. – MichaelF Apr 06 '12 at 14:10

1 Answers1

6

The portion of the URL after # (fragment) is never passed to the server as per HTTP spec, therefore, URL rewrite won't see it.

Source: Does IIS throw away the URL fragment on custom error pages?

Community
  • 1
  • 1
Tom Hall
  • 4,258
  • 2
  • 23
  • 23