Three common URL designs:
The most common design is: everything in lowercase and -
as separator. This is the default in many CMS (including the most popular CMS, WordPress), and for example also used by Stack Overflow: the last path segment of your question’s URL is
/whats-the-best-practice-for-url-path-casing-and-spacing
Wikipedia (and, by default, all MediaWiki sites) use correct case and _
as separator. For example, the page about Stack Overflow has this last path segment:
/Stack_Overflow
(which is different from /Stack_overflow
)
Many (early) wikis use CamelCase and no separator. For example, the page about Stack Overflow in the first wiki (using WikiWikiWeb) has this last segment in the query component:
StackOverflow
Pro separator: It’s easier to see what the string means; and you can avoid misunderstandings (think of teacherstalking: teachers talking, teacher stalking). While CamelCase could help here, it doesn’t work so well for longer strings, e.g., whats-the-best-practice-for-url-path-casing-and-spacing
is easier to grasp than WhatsTheBestPracticeForUrlPathCasingAndSpacing
.
Pro correct case: If your site has pages about different things written the same except for different case (e.g., "Stack Overflow" for the site/company, "Stack overflow" for the programming concept; or "Love" for the noun, "love" for the verb), this is a simple way to disambiguate.
Pro CamelCase: Words written that way can automatically be linked to their corresponding pages; authors don’t have to use hyperlink markup.
Unless your site is a wiki with many authors that don’t know markup so well (in which case CamelCase might be helpful), or something like an encyclopedia that defines things that are typically described by one or only a few words (in which case correct case might be helpful), I would go with the most popular way: use lowercase and the hyphen (-
) as separator. This is what people are used to see.
Google recommends this, too:
Consider using punctuation in your URLs. The URL http://www.example.com/green-dress.html
is much more useful to us than http://www.example.com/greendress.html
.
We recommend that you use hyphens (-
) instead of underscores (_
) in your URLs.