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/.jspextensions. - 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 ofhttp://www.malevolent.com/about/index.phporhttp://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.
Sun 4th Sep 2005, 11:54pm GMT
Filed under: Client-side Coding, Hints and Tips, Search Engines, Server-side Coding, Software, Usability, Web, Weblogs
Comments
Comments are now closed for this entry.
Matt Round’s company blog, covering web development, media, technology and pretty much anything else.
- Web Sites
- Good-looking, effective, accessible sites.
- Multimedia
- Logos, Flash games, animation and illustration.
- Advice
- Help with strategy, planning and getting noticed.

— Greg, 8th Sep, 11:32pm