I know this issue is <i>very</i> old news, but frankly I don't know of any thorough discussions or references. (Help!) In short, it would be great to hear the criteria HNers follow when choosing a link style. For example, from "http://example.com/d1/d2/doc.html" to "http://example.com/d1/foo.html" three choices come to mind:<p>1) Absolute URL ("http://example.com/d1/foo.html")<p>2) Relative URL, absolute path ("/d1/foo.html")<p>3) Relative URL, relative path ("../foo.html")<p>Which type of URL do you favor for your intra-site links? Why? Do you try as much as possible to use a single style throughout the site?<p>Further comments and references would be most welcome.<p>Cheers!
This is going off on a bit of a tangent but I would drop the .html from the URLs as well. Apache's MultiViews option makes this (and content negotiation) a breeze, allowing you to keep the extension on your files but drop it from your URLs. This way, if/when you decide to replace a static page with dynamic content, your users' bookmarks (and your own intra-site links) won't break.
I use relative URLs almost exclusively throughout my sites -- the main exception being anything that ends up or has the potential to end up outside the site, RSS feeds being the primary example. Relative URLs simply won't work there, so anything that gets syndicated (through a feed or otherwise) it's probably best to use absolute URLs.
For option 1, if you're generating pages with templates, just hand off the domain portion to a util method, so if the domain ever does change, it should be a one-line change.