The Benefit of Having Context in URLs
A long time ago, I reworked the URLs of this site. They used to just be the ID of the entry (a la the default MT URL scheme), but then I decided to get cute and embed the date and title in the URL as well. At the time, I wanted to do this simply because I liked the look of it.
The problem came when I had to change the title of an entry (like this one – I thought up a much better title the day after I posted it; see the second paragraph). I couldn’t without busting the URL. This kind of sucked, so I was determined to change the URL scheme back.
However, I was cleaning up some old posts the other day when I found a great benefit to my current URLs – you can usually always tell what post you’re linking to by just the URL.
A lot of these older entries had one of the old ID-centric URL somewhere in the post (linking to another entry, for example), so I needed to convert them. Problem was, somewhere along the way, my database IDs got changed (I think I did an import or something). So none of these URLs matched up to anything anymore. In some cases I was able to figure out where they were pointed based on the context, but often I wasn’t.
A URL like this…
…tells you exactly nothing if the number doesn’t directly match up to a database record. Whereas a URL like this…
…gives you an awful lot to go on.
Of course, this only matters if you change your URL scheme along the way (and if your post IDs get hosed), so maybe the entire problem is invented. Regardless, I think I’m going to keep my current URLs and have a little two-column lookup table triggered by my 404 page into which I can enter old URLs and new URLs in the event I simply have to change the title of an entry.
This is item #225 in a sequence of 285 items.
You can use your left/right arrow keys or swipe left/right to navigate