I want to know what is considered a good practise for casing and spacing in URL paths.
Casing:
- Lower-case
- Camel case
- Pascal case
Spacing:
- None
- Hyphen
- Underscore
../data/upload_data
../data/upload-data
../data/uploadData
../Data/UploadData
What do you think? Which is better?
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 isWikipedia (and, by default, all MediaWiki sites) use correct case and
_as separator. For example, the page about Stack Overflow has this last path segment:(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:
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-spacingis easier to grasp thanWhatsTheBestPracticeForUrlPathCasingAndSpacing.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: