It's well known that URL fragment (the part after the #
) is not sent to the server. I do wonder however how fragments work when a server redirect (via HTTP status 302 and Location:
header) is involved.
My question is really two-fold:
A: If the original URL had a fragment (/original.php#foo
), and a redirect is sent to /new.php
, does the fragment part of the original URL simply get lost? Or does it sometimes get applied to the new URL? Will the new URL ever be /new.php#foo
in this case?
B: Reguardless of the original URL, if the server redirects to a new URL with a fragment (/new.php#foo
), will the fragment get "honored"? Or does the server really have no business interfering with the fragment at all - and will the browser therefore ignore it by simply going to /new.php
?