Main | Second Post »


Gripe: Absolute URL versus Relative URL

Ah FrontPage. You made it so easy to create web sites that there are many, **many** web site developers out there who do not know the difference between an absolute URL and a relative URL. I'm not talking about those cases when you need to link somewhere offsite--I'm talking about links to content that reside on your own site. Yes, this first post is a gripe. You would be surprised with how many times I come across this when we're going through a site. I once spent a couple of hours on the phone going over the differences between absolute URLs, relative URLs, and, of course, the server relative URL with a group of developers and I think by the end of the conversation, they were just saying "ok" to get me off the phone. What's wrong with using an absolute URL within your own site to link to your own content? Consider the following HTML for a fictional company's product manuals.

Absolute URL Example

a href=""> Product Manuals

Relative URL Example

a href="manual/index.html"> Product Manuals

Although both work and will result in loading the same page, the first will make troubleshooting problems with the web site a little bit tougher.

Consider the following example: runs across a pair of web servers, and A browser making a request for the homepage hits the load-balancer and the load-balancer sends that request off to one of the two real web servers. Now let's say that some of our customers are reporting an "intermittent" problem with one of the two web servers getting the manual. We operations-types fire up a browser and go to, (bypassing the load-balancer), and then click the link for the manuals. The trouble hits when we click that link. Due to there being an absolute URL, our browser gets sent back to the address instead of going to the real server. If we experience a 404-Not Found error, we still don't really know which server is generating the error.

I understand that this example may be over-simplistic because since we assumed these were static pages, then we could just go to and see if we get an error and repeat the step for serverB. This becomes more annoying when there are dynamically-generated URLs and you have to go to the homepage, login, etc. Obviously, the scope of this article is geared towards web sites developed and running within the enterprise. Sites that are load-balanced because they have to be up. Sites that cost the company serious money when they are down.

Ditto for those base href's that some folks are so fond of. Avoid absolute URLs and base href's if at all possible.


TrackBack URL for this entry:

Listed below are links to weblogs that reference Gripe: Absolute URL versus Relative URL: