Creating a new URL

The following was written before the usage of URLs (URIs) was much reduced through the use of Drupal's Books, Stories and navigation systems.

The URLs of particular pages are part of the user interface of this web site and should be chosen carefully, if they are needed. Although many users will never manually type a URL, they may see them in the address bar of their web browser, they may copy and paste them into emails to friends, and they may see them in print in articles, for example in the Journal.

URLs should never change. Once a page has been published, it may get bookmarked, linked to from other sites, indexed by search engines, and so on. This means that it is important to get the URL right first time. If in any doubt, please consult with someone else (the webmaster?) for guidance. Having said that, if absolutely necessary, a page can be moved to a different URL, and things can be done to ensure that people trying to visit the old URL get redirected.

Since getting URLs right first time is quite important, the webmaster considered a policy that you must ask every time before creating a new page. However, this was rejected this as unnecessarily draconian. You may still want to ask the webmaster anyway, since he may need to work out where any new page should fit into the site structure, where it should be linked from; and the indexer will need to be informed of the new page's existence. It is not that the webmaster thinks you are likely to make mistakes (at least no more likely than he is), but that correcting a mistake later is painful, and the more pairs of eyes that look at what is proposed before it is set in stone, the more chance there is of any mistakes coming to light when they can be fixed painlessly.

When choosing the URL for a new page, please consider:

  • People looking at the URL should have a reasonable idea what it points to.
  • URLs should be as short as possible (URLs longer than one line of a plain text email—about 72 characters—are particularly bad).
  • Only lower-case letters should be used in URLs. Upper-case letters are perfectly valid, but unusual, and users should not have to think about upper/lower case when they are entering a URL, so keep it all lower-case.
  • Similarly, avoid all punctuation other than ‘/’ and ‘.’.
  • When running two words together (don’t, unless you have to) be careful. ‘danpromotion’ is OK. Something like ‘fortypee’ would be ambiguous (forty pee, for type e, OK, you could probably make up a better example yourself), and should be avoided.
  • The URL should describe the contents of the page identified, and not the technology used to produce it. So avoid URLs like:

    • ‘/cgi-big/…’
    • ‘/tournaments/index.html’ (Keep the file as /tournaments/index.html on the server, but always refer to it as plain ‘/tournaments/’ in URLs)
    • ‘pagename.php’, ‘pagename.shtml’, and so on—the user is not interested in how the page they are viewing was generated. (Even ‘.html’ is arguably bad, however, HTML is the format of the information in the page, not how it was produced, so may convey some useful information. For example you could have pages ‘fred.txt’, ‘fred.html’, ‘fred.pdf’ which present the same information in different formats. And in URLs like ‘image.png’ and ‘image.jpeg’ the information about file format certainly is useful.)
  • Particular extensions:

    • Use ‘.html’, not ‘.htm’
    • Use ‘.jpg’, not ‘.jpeg’
    • The webmaster has now modified the setup so the rules about particular extensions are enforced. That is, if you attempt to go to the page something.htm, it will immediately redirect you to something.html.

Note: Drupal does not require that you include an extension, and arguably it's better if we don't use them in future. However, any reference to another page on the site must match exactly the URL that is allocated for the item in question. That is, if an extension is used when the item is created then is must be quoted in the reference. If not, then not.

All existing pages have their URL recorded on the system with and without .html for ease of access and to preserve existing links. There are additional short-cut URLs that don't have the .html.

Generally the one held on the page is the one without the .html, with the one with the .html declared as an additional alias against the node.

News stories do not have meaningful URLs recorded against them.



Last updated Thu May 20 2010. If you have any comments, please email the webmaster on web-master AT britgo DOT org.