Clean & Hackable URLs

Post ImageA week ago, Roland Tanglao reiterated his love for clean URLs. Or perhaps more accurately, his hatred of dirty (?) URLs. Here’s what he wrote:

URLs with question marks, ampersands, etc should be banished to the Web 1.0 h*ll where they belong. I’ve been preaching the clean URL gospel for years but if I see one more WordPress blog with “?p” or one more Drupal site with “?q”, I’ll scream 🙂 Seriously if your webhost or your tech gal/guy can’t figure out how to use clean URLs, find somebody else. It’s 2007!

I couldn’t agree more. Here’s an example of what he means:

Dirty: http://example.com/articles.html?articleid=123&tag=rss
Clean: http://example.com/articles/123/rss

Clearly I prefer the second one, and I’m guessing you do too. I’m going to go one step further though, and say that not only should URLs be clean, they should be hackable! What does that mean? Let me give you an example:

http://mastermaq.podcastspot.com/episodes/FF7962/license
http://mastermaq.podcastspot.com/episodes/FF7962
http://mastermaq.podcastspot.com/episodes
http://mastermaq.podcastspot.com

The first link is for the licensing information of an episode. All you’ve got to do is “hack” off the end and you get the episode itself. One more hack and you get all the episodes. And finally, you’re left with the entire podcast. It’s pretty logical right? And it would be trivial to replace the episode ID with another one, or /episodes with /tags, etc. That’s what I mean by hackable – they are easily modified to get you where you want to go.

Here’s another example:

http://mastermaq.podcastspot.com/episodes/archive/2007/02/24

That will show you all episodes for February 24th, 2007. The URL is readable, and immediately you understand what it is doing. What if you want a different day? Replace 24 with something else. Just the month? Hack off the 24. You get the idea.

Clearly I am drinking the clean & hackable URLs koolaid, and as a result Podcast Spot has nothing but clean, hackable URLs. If you’re working on a web project, consider doing the same – your users will thank you for it.

3 thoughts on “Clean & Hackable URLs

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s