[This question is somewhat related to this question, but the answers are not…]
I have always used relative paths in HTML and scripting languages (PHP/ASP/JSP) to refer to EVERYTHING. I think the justification had to do with ‘what if the website gets hosted in some weird subdirectory.’ But my coworker has started throwing absolute paths into a PHP site we’re working on. At first I was appalled, but then I thought, ‘why not? We’ll never be hosted in a subdirectory.’ Nowadays, getting hosted in the root is not an uncommon necessity. Is it still necessary to ‘code’ (markup, really) with relative paths? I think it’s probably an antiquated practice by now.
Edit: Killed my opening paragraph as it was based on a miss-interpretation of the referenced article.
I always use an absolute path for the following reasons:
Includes: 1. When you use a templating system, you never know the directory structure that a document is going to have when it’s calling the include. 2. If documents are going to be moved around, you can be pretty sure it’s going to be the documents themselves rather than the includes. If it is the includes, then they’re being moved my someone who knows what going on. Added to this, if it is someone not familiar with absolute/relative path, they’ll understand absolute a lot better than relative.
css: (as well as the items above) 1. When editing with Web Developer, relative backgrounds disappear when your style sheet isn’t in the same directory as the doc. 2. By spec, when you put something on the ‘Net, it should be there for the duration. When I’m building something new, I build it in a new folder, or with a new file name and leave all the old docs alone.