When you are creating a new URI for a site you are building, give it a lot of thought. You should aim to design a URI which can last forever. Of course, this is not news. Jakob Nielsen said it 10 years ago. But in the intervening 10 years, we’ve gone from URIs which typically used to look something like this:
…which is fine, because if you go to such a link, you probably really will get HTML back, to URIs which (often) look something like this:
…which, as I noted in a previous post, is a lie. Actually, it’s worse than a lie; it’s poor encapsulation. What happens when you come to your senses and stop using PHP? Now you URIs have to change, which means you get to either create redirects for that abomination or break every link to your site. One of the things we’ve learned from the success of Google is that the information encoded in the links between sites is nearly as important as the information on the sites itself.
The web is dynamic. It has to be, because it is too big to compile. And so the same concerns we have when writing code and dynamic languages often apply to creating a web site, whether you use a dynamic language or not. You need to choose very good names, because if you ever need to change them you will either break stuff or have a substantial job on your hands correcting every reference to the name you’ve changed, including references you don’t personally control.
So I’m going to propose a general rule, which states, "Any URI which allows an informed developer to discern the technology used to serve the result is probably broken." The resources you are serving, if they are at all valuable to the user, will probably last longer than the implementation you use to serve them.
Of course, choosing good names is hard. I read a great quote the other day:
There are only two hard things in Computer Science: cache invalidation and naming things. -Phil Karlton
Also, even after you’ve chosen a good URI, you may have to do extra work to make it functional. If routing is not built into the technology stack you’re using, you may have to implement a URL rewriter to make your persistent URIs functional. It’s worth the effort to do so.