One goal in the move to new software on Workbench is to salvage incoming links from other sites. When you break weblog entry permalinks, you break links on every site that referred to your entries. Because I use weblog archives as a research tool often in my programming, I don't want to hose permalinks switching from Radio UserLand to my hand-coded LAMP software.
I thought I could write a short PHP script to redirect each old Radio-style link to its new link -- just grab the anchor portion of the URL that follows the pound sign ("#"), make a MySQL database query to match the old anchor to the new one, then redirect the request to the proper resource.
No such luck.
The portion of a URL that follows "#" is called the fragment identifier. Radio finds an entry's internal ID number with this fragment -- for instance, #a1833 refers to entry 1833 in the weblogData.posts table.
Much to my surprise, fragment identifiers are not passed by a Web browser to a server as part of a URL request. Instead, they're used strictly by the Web browser, as described by the W3C:
Interpretation of the fragment identifier is performed solely by the agent that dereferences a URI; the fragment identifier is not passed to other systems during the process of retrieval. This means that some intermediaries in Web architecture (such as proxies) have no interaction with fragment identifiers and that redirection (in HTTP [RFC2616], for example) does not account for fragments.
When you request http://ekzemplo.com/view.html#note, the server only receives http://ekzemplo.com/view.html. The browser loads the page and jumps to the anchor named note.
Because the browser doesn't share the fragment identifier, there's no way for a Web application, Apache's mod_rewrite module, or anything else on the server to take action based on that part of the URL.
More details can be found in a proposed Internet draft about fragments and URL redirection.
To retain old permalinks, my new software puts two anchors in an old entry -- its Radio ID and new ID, as in this example:
Perhaps this is old news, but I'm amazed at the design implications of this fragment issue for entry-based publishing tools like Radio. Web servers never see the full permalink generated by the software (or my own, which also uses "#" links). I'm thinking about recoding to drop fragment identifiers in permalinks, but I can't figure out how without adopting a one-entry-per-page approach to archives, which I'd like to avoid.