9

We are currently deciding on a consistent naming convention across a site with multiple web applications. Historically, I've been an advocate of the 'lowercase all the letters!' when creating URLs:

http://example.com/mysystem/account/view/1551

However, within the last year or two, specifically since I began using ASP.NET MVC & had more dealings with REST based URLs, I've become a fan of capitalizing the first letter of each section/word within the URL as it makes it easier to read (imho).

http://example.com/MySystem/Account/View/1551

We're not in a situation where people need to read or be able to understand the URLs, so that's not a driver per se. The main thing we are after is a consistent approach that is rational and makes sense.

Are there any standards that declare it good to do one way or another, or issues that we may run into on (at least realistically modern) setups that would choose a preference over another? What is the general consensus for this debate currently?

6 Answers 6

10

As the choice is mainly cosmetic (ie, most systems don't differentiate between upper and lower case, and users certainly don't), then I'd suggest just going with whichever makes you happy. Consistency within the application is the key, not the manner you choose.

As you're using ASP.Net, I'd recommend going with the PascalCase approach - as that is what tends to exist within the Microsoft framework (system libraries, etc.) But there are no "best practices" other than being consistent.

Most browsers do a fairly good job of hiding the URL from the user, to such an extent that a great many people who have google as their home page, will then search for facebook and click on it - rather than entering the facebook url in their browser.

3
  • 7
    But the system does differentiate
    – ghoppe
    Feb 28, 2012 at 21:10
  • 2
    You should at least mention that the case sensitivity is up to the server configuration so it's worth consideration, rather than stating incorrectly that the system doesn't differentiate between upper and lower case.
    – jleach
    Jul 28, 2016 at 1:15
  • @jdl134679 done.
    – TZHX
    Jul 28, 2016 at 10:18
4

For internal websites, it doesn't matter so much as long as you're consistent with it.

For external, public facing, sites, you probably want to stick with lower case which is more or less the standard in Linux/Apache web hosting. As I recall, some versions of Firefox also seem to handle URL casing differently than IE. This might also apply to Chrome as well.

Having consistent casing also matters for search engine optimization. You don't want Google to see lower-case.aspx and Lower-Case.aspx as different pages with duplicate content. While their algorithms try to prevent this mistaken identity, it does happen from time to time and can cause a page to be penalized.

2

As long as users can type it however they want, it really does not matter. Personally, I prefer TitleCase, but there are many who disagree. If you are consistent, no one will mind.

If your web server cannot, for some reason, show me http://foo.com/HelloWorld when I try to go to http://foo.com/helloworld, you should opt for all-lowercase. While people rarely type full URLs these days, front-facing addresses should be accessible without having to fiddle around with capitalization.

2

That you started using MVC should not "leak" into your REST abstraction. There are good reasons to use all lowercase URLs with dashes between words. URIs (not domain names) ARE case sensitive. If you lowercase everything and use dashes to separate words, you have eliminated a lot of guess work and one-offs, and if you use a proxy server (nginx, nodejs, apache...) you won't have everything start to break because it's suddenly case-sensitive.

"MiXeD-CaSe NaMeS. Don't confuse your users by-Mixing-Upper-case-and-Lower-case-Characters-in-the-URL. Stick to lower-case letters, and don't make them guess. If your user actually types in a URL in mixed case, normalize it on the server and serve the appropriate case".

1

While TLDs are not case-sensitive and Windows paths use a combination of capital and Pascal case, our applications are sensitive to the incoming request paths, where paths, or components therein, are usually normalized to a standard case, since /format/JSON/ and /format/json/ are requests for two different formats and reference two distinct resources.

Whenever I've seen http://www.somewebsite.com/Having/URLs/That-Look-Something-Like-This/, I felt like the developer's intent was mainly to appear a bit different from the rest, but it's nothing innovating and neither does it help improve readability, especially now that you have I and l, O and 0, other letters contending for your analysis.

I'm not aware of any consensus, neither do I believe that there should be one, because something as simple as capitalizing only certain parts of a URL could have a positive impact on readability and I'm sure someone, somewhere is already coming up with interesting ideas when it comes to applying letter cases to URLs.

But, judging by the fact that most Web servers are running on Linux and that we developers always end up standardizing incoming text data because the input is case-sensitive, I'm sticking to how it's been done all along.

0

NEVER use title case for usability reason! Imagine how many time you should spend and clicks to perform for different case URL in your MOBILE phone!

2
  • Although on my iPhone, title case requires fewer extra keystrokes than '-' or '_'.
    – BradS
    Apr 5, 2013 at 12:58
  • Modern smartphones, at least Windows phones allow swipe from caps key to achieve this in single swipe
    – 0fnt
    Jul 28, 2016 at 5:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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