Coding with Jesse

A URL is forever

The golden rule of URLs: They never change.

This certainly isn't a new topic. In fact, it's as old as the web itself. It seems like it's been long forgotten, brushed off and ignored. It is still highly relevant and can't be stressed enough.

When designing URLs, assume they will be still be used 1000 years from now. Why? People already assume they won't change. They bookmark the page, search engines index the page, other sites link to the page. It's your responsibility to keep the page there.

Web applications, search engines, online shopping and sadly even simple web sites have designed URLs to be disposable, full of variables including session IDs and other junk. How often have you sent or received a URL that didn't work because the "session has timed out" or some other reason?

You can improve the permanence of a URL by making it as simple as possible. Try not to include a file extension (.html, .php, etc.) Try to split things up into a logical hierarchy. Using dates in the URL like /2006/3/ can help a site grow over time, but so can using a unique ID such as a number or title.

Sometimes URLs just have to change. Perhaps the original URL was one of those temporary, junk-filled ones and you are migrating to a permanent URL system. When this happens, make sure you put something in place to send the visitor to the new location.

There is already a great document written on this topic, so rather than repeat everything, I will include it here. I highly suggest you read it if you haven't yet:

W3C: Cool URIs don't change

Published on March 21st, 2006. © Jesse Skinner

About the author

Jesse Skinner

Hi, I'm Jesse Skinner. I'm a web development coach & consultant. I teach web development teams how to scale up their server infrastructure, improve automated testing and monitoring, reduce costs, and modernize their legacy systems. I focus on empowering teams through customized training and coaching.

Feel free to email me. I'm eager to hear about your challenges and see how I can make your life easier.