Basic URL Advice

It’s about time for another look at some basic mistakes that people make on the internet. Today we’re going to be looking at URLs. It’s important to design a useful URL scheme for your web site. The easier your URLs are to understand, the more likely it is that people with share them with their friends.

The basic premise behind all of these ideas is that by making it easier for people to link to specific parts of your site then they will link to your site and will bring you more visitors. Of course this means that you’ll be encouraging people to visit your site using routes that don’t bring them through the front page. Some people have a problem with that. I believe that sites that don’t encourage that flexibility will slowly lose visitors to sites that do.

Domain names

We’ll start with the first part of a URL – the domain name. I’m not going to talk about registering a domain, I’ll assume that you’ve already done that. But how is your web server configured? Do you insist that people type ‘www’ at the start of your URL? And if so, why? There is no good reason why a visitor should type those extra three characters (four including the dot) each time they want to visit your site. It’s very simple to configure your web server to respond to both names.

Memorable

A good URL is memorable. If you have an article about sheep farming that has the URL http://your_domain.com/sheep_farming.html then people will be able to find it more easily than if the URL is http://your_domain.com/0,,1704174,00.html or something like that.

This often isn’t an easy problem to solve. In my experience all commercial Content Management Systems produce horrible URLs (which is why most newspaper sites have horrible URLs) and most blog software isn’t much better (I realise that the URLs on this site aren’t at all memorable – I have plans to improve that).

Simple

Part of being memorable is making your URLs as simple as possible. A good example of not doing that is Amazon. The URL for any product on Amazon is very simple. It looks like this http://www.amazon.co.uk/exec/obidos/ASIN/0596004761. The only bit that changes is the number at the end which defines the particular product that we are looking at.

So far, so good. That’s the URL as you need it if you want to pass it on to someone else or to link to the product. But Amazon never shows you that URL. It always adds some tracking information to the end of the URL. So Amazon URLs always appear more complex than they need to be. Of course I don’t expect Amazon to take this advice and change the way their systems overnight. This seems to be a good example of a company that is soe successful that they can ignore good practice whenever they want.

Other good examples of overcomplex URLs are often found on mapping sites. Try searching for a postcode on Multimap. I just got a URL back that containing 13 parameters. It looked like this (I’ve inserted spaces so that it wraps):

http://www.multimap.com/map/browse.cgi?client=public &search_result= &db=pc &cidr_client=none &lang= &keepicon=true &pc=SW129RW &advanced= &client=public &addr2= &quicksearch=sw12+9rw &addr3= &addr1=

A bit of experimentation revealed that only one of them was necessary:

http://www.multimap.com/map/browse.cgi?pc=SW129RW

Which of those two would you rather send to a friend?

Permanent

If you want people to link to your pages then you need to give them fixed places to link to. A few years ago I was trying to discuss a particular news story with some friends over email. The site in question (and I can’t remember what it was) had ten news stories on its front page. The newest story was always http://some_news_site.com/news1.html and so on through to news10.html. As a new story was published, all the existing stories had their URLs changed. It was difficult to hold a conversation about the story. It would have been impossible to link to it in a blog entry.

Not all permanence problems are so obvious. Some news sites have free access to stories for a few days after they are published but later move them behind a registration screen (or require payment). Others move stories to a different location after some time. If your content isn’t always available at the same URL then people won’t link to it. Of course, some newspapers might see that as a advantage.

That’s not to say that you shouldn’t also have transient URLs. It’s perfectly acceptable to have a latest.html link which always points to your latest article. But each article should also have a permanent URL and it should be easy to find out what that URL is.

Hackable

(And I’m using “hack” in the positive sense here.)

If your URLs reflect the structure of your site then people will be able to navigate round the site by editing the URL in the location bar of their browser. For example if /news/uk/politics/blair_resigns.html is the URL of a particular story, then /news/uk/politics should contain a list of current UK political news stories and /news/uk should contain a list of UK news.

One side-effect of this is that you need to work out all possible URLs that someone might try to visit and put something in place. You can’t assume that people will only visit URLs that you publish. In the previous example you might not ever publish a link to /news/uk but you still need to put some kind of content there as otherwise anyone trying to visit that URL will get either an error page or (probably worse) a list of files in that directory.

Anchors

It’s always worth adding internal anchors within your page so that people can link to specific sections of the page. For example, all comments on my blog have their own anchor so that you can link to them.

Frames

Only one thing to say about frames – don’t use them. The URL for a frameset refers to its initial state. Once you’ve clicked on something and changed the view, it becomes impossible for someone to construct a URL which will bring someone else back to that exact view.

This is part of an occasional series of articles about basic internet technologies. The previous articles in the series are Basic Password Handling and Basic Bulk Emailing.

2 comments

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.