Home > Web > PHP >

URL Fragment not Accessible to PHP

Posted Dec 11, 2006
Last Updated Nov 11, 2011

During a recent upgrade to Webonizer, I had to incorporate a redirect to handle article URL changes. In it I found that redirects to pages that included a path to specific IDs in a page were not working—links using the URL Fragment (the part of a web address starting with the pound sign or hash—#).

I tried to find a way to access the URL Fragment on the server side to remake URL redirects… but to my consternation found that the fragment is not sent to the server. It is kept and dealt with only by your browser. PHP cannot tell you what the fragment is in a URL.

Firefox currently chooses to keep your Fragment and re-apply it to redirect pages. Internet Explorer (IE6 and IE7) does not reapply the Fragment in redirects.

Comment

No HTML Tags are permitted.

Angry Teapot Level Design Awards

Newsletter Subscription