Skip to navigation

malevolent design weblog

This blog is now defunct, but you can find more stuff over at my personal site

Finishing Touches: Useful URLs

Tidy, human-readable URLs look better to users and increase traffic from search engines. It’s easier than ever to implement them, with simple rewriting technologies available for pretty much every development platform, yet developers are still churning out rubbish. Look at a couple of typical pages from MSN Spaces, for example:

http://spaces.msn.com/members/top5lists/Blog/cns!1puPfoHhacRMRSVKPoZW6CbQ!384.entry
http://spaces.msn.com/members/top5lists/PersonalSpace.aspx?_c01_ListID=cns!1puPfoHhacRMRSVKPoZW6CbQ!361&_c=links:a7a82db7

Ouch.

Want to do better than Microsoft? Here's what I’ve learned from building this site and countless others:

  • Think of the browser’s address bar as part of your site’s user interface.
  • Consider URLs to be part of the site’s architecture; think about them during planning phases.
  • Try to choose a structure that’ll last, to help avoid disruption in the future.
  • Strike a careful balance between clarity, consistency and brevity when picking folder names.
  • Keep everything lowercased for simplicity and consistency.
  • Use hyphens to separate words; search engines recognise them as word separators, and they don’t get obscured by underlines as underscores do.
  • If a URL is for use in offline promotional material (e.g. print or radio ads), it needs to be particularly short, unambiguous when read/heard, and easy to type. Sometimes those priorities clash with the needs of the site, in which case set up redirects for the promotions.
  • Hide technology away as much as possible. There’s no need to expose all the .asp/.php/.jsp extensions.
  • Where there’s a hierarchy, reflect it in the folder structure, e.g. ‘Multimedia’ is within ‘Services’, resulting in http://www.malevolent.com/services/multimedia/ .
  • If your site has a static structure (i.e. it’s created with files, not dynamically from a CMS), make use of folders and default documents, e.g. http://www.malevolent.com/about/ instead of http://www.malevolent.com/about/index.php or http://www.malevolent.com/about.php .
  • If your site’s dynamic, use some form of URL rewriting to divert requests behind the scenes, so you don’t need actual folders and files. Apache has mod_rewrite, and for IIS there are various ISAPI filters and ASP.NET features.
  • Always make sure a helpful 404 error page is returned if the page requested doesn’t exist, don’t serve up the home page or forget to set the status code (which often happens when people rewrite URLs).
  • If a page is moved, set up a permanent redirect (not a temporary redirect, or one created with HTML or JavaScript) from the old location so that search engines update their indexes properly.

Comments

The statement "Think of the browser’s address bar as part of your site’s user interface." can be strengthened a bit. It plain-old is a part of your site's user interface because, like it or not, users will interface with it. I say this only to agree strongly with your ideas.

— Greg, 8th Sep, 11:32pm


Comments are now closed for this entry.