Home

Sane URLs

What is up with your URLs, eBay? When you click a link from an eBay search, you go to a URL that looks like this:

http://cgi.ebay.com/Bernard-Madoff-Ceramic-Coffee-Mug-Hard-to-get_W0QQitemZ200319297841QQcmdZViewItemQQptZLH_DefaultDomain_0?hash=item200319297841&_trksid=p3286.c0.m14&_trkparms=72%3A1205|66%3A2|65%3A12|39%3A1|240%3A1318|301%3A0|293%3A1|294%3A50

This is obviously insane — there’s no reason URLs can’t be both unambiguous and human-readable.

Some guidelines:

  • The domain should make sense. What the fuck is cgi? This is gibberish to any non-technical user. The domain should just be ebay.com (I’m looking in your direction, www2.seamlessweb.com).

  • Since URLs need to unambiguously point to a single page, it won’t always be possible to make them entirely human-readable. However, you should limit the non-human-readable portion of the URL to the shortest string necessary to ensure uniqueness.

  • URLs should include additional text to make them easy to identify. eBay actually does an okay job of this by including “Bernard-Madoff-Ceramic-Coffee-Mug-Hard-to-get”, but ideally this should appear at the end of the URL.

Here’s a quick improvement on that eBay URL:

http://ebay.com/auctions/123456/Bernard-Madoff-Ceramic-Coffee-Mug-Hard-to-get

where 123456 is the auction’s unique internal id. Of course http://ebay.com/auctions/123456/ should work as well (since the auction is uniquely identified by the numeric string).

This is a good generic solution, but we might be able to do even better. I.e., there might be a more human-readable way to make the URL unique than embedding the auction’s internal id. For example, eBay could use a Blogger-like strategy:

http://ebay.com/auctions/end-date-20090315/Bernard-Madoff-Ceramic-Coffee-Mug-Hard-to-get

If two auctions with the same name share an end date, append a number to the end of the URL. If you want to avoid this, you could add information about the seller to the URL:

http://ebay.com/auctions/seller-rogrpodcater/end-date-20090315/Bernard-Madoff-Ceramic-Coffee-Mug-Hard-to-get

The nice part about this solution is that you could have http://ebay.com/auctions/seller-rogrpodcater take you to a page listing all of rogrpodacter’s auctions. The downside to this solution is that now the URL is getting pretty long.

There will always be a tension in URLs between human-readability, unambiguousness, and brevity. The important thing is making sure that you don’t sacrifice one value without improving another.

Posted March 16th, 2009