Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does IIS URL Rewrite handle # anchor tags

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")

like image 932
Spongeboy Avatar asked Feb 23 '12 22:02

Spongeboy


1 Answers

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?

like image 126
Tom Hall Avatar answered Oct 04 '22 06:10

Tom Hall