19

How should a good URI be designed? What are the factors to consider? What are the pros and cons of the variants?

Factors that makes up a good URI

  • Stability over time
  • Short
  • Give the user an idea what is linked
  • Easy to type
  • Easy to guess (relevant only for a few links like "/jobs")
  • Search engine friendly
  • URI schema should be consistent over the whole site
  • URI schema should allow future extensions

Any more?

Examples

  • example.com/articles/3252
  • example.com/articles/how+to+design+good+uri
  • example.com/articles/3252/how+to+design+good+uri
  • example.com/good-uri-design
  • example.com/articles/good-uri-design
  • example.com/a/good-uri-design
7
  • Polls like this should always be a Community Wiki. Furthermore, the presentation of the question is overly leading IMO.
    – Kris
    Commented Aug 11, 2010 at 9:17
  • You're right the arguments were leading. I've removed them. I changed it to community wiki.
    – deamon
    Commented Aug 11, 2010 at 9:30
  • 4
    I don't like the idea of turning PW into a poll site. The question itself has some merit but to just turn it into a popularity content is stupid. Commented Aug 11, 2010 at 10:07
  • 1
    I agree in that the question is not a candidate for a simple voting.
    – deamon
    Commented Aug 11, 2010 at 10:21
  • Can you re-phrase this question to encourage answers that have some sort of technical merit? Right now, it is similar to asking "Do you like blue, green or some other color?" Flag this for moderator attention if you do, and we can re-open it.
    – Tim Post
    Commented Aug 12, 2010 at 14:46

4 Answers 4

15

The real answer is to use whatever suits your site best. Some facts:

  • Keywords in the URL aid SEO and give users an idea of what the page is about. This is true for both static and dynamic URLs.
  • The consensus is that a lowercase slug, separated by dashes, is the best.
  • Search engines index dynamic URIs (e.g. index.php?page=about) just fine.
  • Using ID numbers in URLs is much easier/faster for grabbing the content from the database.
  • Search Engines prefer unique URLs, so it's best to avoid having parts of the URL with no bearing on what is displayed if possible.
  • Use rel="canonical" if you can't avoid possible duplicates. example.com/1234/my-page in theory should be different to example.com/1234/my-pgae but for most practical purposes they end up returning the same content, like on this site.
3
  • 3
    All great tips, but the SEO benefit of keywords in the URL is largely a myth - googlewebmastercentral.blogspot.com/2008/09/… Commented Aug 11, 2010 at 21:52
  • 1
    @Gabe: That page is completely irrelevant to the discussion and your point. If you have keywords in the URL, whether it is dynamic or static, it will aid SEO. That page does nothing to dispel that fact, it is simply saying if you already have dynamic URLs, there is no need to change to static (doing so could cause harm). Commented Aug 12, 2010 at 12:42
  • 2
    Using IDs in URLs also has the advantage that after renaming the resource (e.g. this question's title could change), the old URL will still redirect easily to the new resource. Commented Apr 26, 2020 at 23:30
8

This advice, from Jakob Neilsen, was written back in 1999 but still seems pertinent today:

The URL will continue to be part of the Web user interface for several more years, so a usable site requires:

  • a domain name that is easy to remember and easy to spell
  • short URLs
  • easy-to-type URLs
  • URLs that visualize the site structure
  • URLs that are "hackable" to allow users to move to higher levels of the information architecture by hacking off the end of the URL
  • persistent URLs that don't change

From: URL as UI

1
  • 1
    Nielsen advocates hierarchies in URIs, but they are problematic, because it is very likely that they change over time. And hierarchies are unidimensional, what makes the structure somewhat inflexible. But I agree with the other points.
    – deamon
    Commented Aug 14, 2010 at 14:10
5

Neither:

http://example.com/good-uri-design

or at least:

http://example.com/articles/good-uri-design

Good slugs are not necessarily the same as the title, they should be concise and use URL friendly characters.

1
  • Thank you for pointing out that the slug must not be the document title. It is so common (see this site) that I used it without thinking about it.
    – deamon
    Commented Aug 13, 2010 at 6:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.