Choose URIs wisely
Few things are more annoying than going to your favorite shop and seeing that the shop has closed or moved without giving its new location... The shop owner may have had a lot of good reasons to do this, but invariably the cause for this unpleasant situation is lack of good planning and management.
Same goes for Web resources...
Think before you publish
Obvious as this advice may seem, it is not always well and fully followed. For instance, in addition to being attentive to the quality of the resource, one should also be careful in choosing a publication location that is well adapted to its style and purpose.
Ideally, the URI (short for "Universal or Uniform Resource Identifier") used to reference a resource on the Web should not have any importance, and does not necessarily need to be tied to the file system of the web server publishing the resource. However, given that very few Web servers are flexible enough in their mapping of URIs and that URI are used in various ways, it is best to follow the following few principles and ideas when publishing a Web resource.
URI choice checklist
A few questions to consider when you choose a URI for a new location:
- Can you easily write the chosen URI on a piece of paper, or can you remember it easily?
- Can you spell the chosen URI on the phone?
- Does the chosen URI give hints about the content of the resource? Will it still make sense if the resource evolves?
- Did you choose to locate the URI near the root level of your Web server? Are you certain it is the best location?
- Can you see any reason that would force you to move this resource in the future? New resources that would fit better at this location? A re-organisation of your server maybe?
A few technical tips for good choices: these tips are not detailed here, but the documents in the Further Reading section of this document provide more detailed explanations.
- Keep it short. Use lower-case URIs if possible.
- Organise your Web site by topics for big areas, and use dated URIs such as
http://www.example.org/2003/10/meeting-minutes
for standalone documents. You can also choose to use dated space in addition to a classification by Area for extra tidyness. - Use format negotiation to hide file extensions in URIs, giving you enough flexibility to change the underlying technology without too much pain.
And finally, since nobody is perfect, learn to manage URIs for when you find out your choice was not so good after all.
Further Reading
- The original "Cool URIs don't change" By Tim Berners-Lee.
- Understanding URIs in "Common HTTP implementation problems"
- Managing URIs, a companion to this Web QA Tip.
- Another Web QA Tip on making readable URIs
About the "QA Tips"
The W3C QA Tips are short documents explaining useful bits of knowledge for Web developers or designers, hosted and produced by the Quality Assurance Interest Group at W3C.
While the tips are carefully reviewed by the participants of the group, they should not be seen as anything else than informative bits of wisdom, and especially, they are not normative W3C technical specifications.
Learn more about the Tips, how to submit your own pearls of wisdom, and find all the other QA tips in the Tips Index.