To WWW or not to WWW?
07 Jan 2017
Recently I had an discussion at work about the proper use of URL's for our site. The first item being discussed was the use of www in the domainname of the site. At the time of writing the site used www in its domainname but there where questions about whether or not we should change to the shorter version without www. A shorter domainname (and consequently shorter URL's) would be better for use in character limited communication (like Twitter or SMS). The use of www is also basically obsolete, in the early days of the web it was used to distinguish between protocols (e.g. www.company.nl, mail.company.nl, ftp.company.nl). The addition of www was necessary in those days to tell systems that this was actually a website. Because there seemed to be no more technical necessity to use www in a domainname, it has become more of a personal preference whether you use it or not. Using our domainname without www (called a naked domain) seemed to be the better option, just on account of the fact that it was shorter, but before we made a decision I wanted to do some more research if there where any reasons not to choose for a naked domain.
Parts of a domainname
First a short summary of what makes up a domainname. A standard domain like www.mydomain.nl consists of the following parts:
- nl => toplevel domain
- mydomain => secondary level domain
- www => third level domain
1. Top level domain
This is a country code (.nl, .de) or a generic domain (.com, .net).
2. Secondary level domain
This is usually the name of the site (or company owning the site). Domains at this level (mydomain.nl) are called root domains.
3. Third level domain
This is an optional level but most sites use it. Most of the time www is used for this level but bigger sites sometimes use it to distinguish between alternate language versions of their site (en.wikipedia.org, de.wikipedia.org, for the English and German versions of Wikipedia). This level is also used to host static content (like images.company.nl or static.company.nl to host images). Subsites will also often be declared at this level (like campaign.company.nl or christmas.company.nl). Domains at this level are called subdomains, www.company.nl would be a subdomain of the rootdomain company.nl.
Separation of cookies
When using a naked domain (like mycompany.nl) as your main domain all cookies set for this domain are also send along with all requests to all your subdomains (like subdomain.mycompany.nl). For sites that use a static content subdomain (like images.mycompany.nl) this would mean that for all requests to static content (like images) all cookies set at your naked main domain are send along with these requests. This adds extra and unnecessary overhead to those requests which could add up to a few KB's, depending on the total size of your cookies. When you choose to add www to your main domainname you are better able to separate your cookies between your main domain and your other subdomains.
Flexibility of DNS records
An other possible problem when using a naked domain is the fact that you can only add a naked domain as an A record and not as a CNAME record. Hosting providers often use CNAME records to quickly switch sites to other servers, for example in the event the original server is down. Because a domain which uses www can be used as a CNAME record it would give more flexibility in managing your DNS records.
Marketing and communication
Whether you like www.company.nl better than company.nl is a matter of personal preference. But in general people will recognize a domainname with www more quickly as being a website than a naked domain. For forms of communication where the website URL has a prominent place this won't be a real problem but in larger bodies of text an URL which does not start with www wil be easier to miss. This could be remedied by adding the protocol to the URL (like http://company.nl). If this is a desirable fix is also a matter of taste.
You also have to take into account that not all digital communication tools (like word processors and messaging apps) will recognise URL's without www as an actual URL. Most tools wil make URL's in the text clickable. But for some tools you will miss out on this functionality when using a naked domain. This can again be fixed by adding the protocol (like http or https) to the URL.
Conclusion
There are reasons to use a naked domain (shorter URL's or personal preference) and some companies have gone for this option, amongst them is Twitter. You don't have to run into problems when you use a naked domain but you do have to check a few possible issues and determine if they are a problem in your case. The issues with Separation of cookies and Flexibility of DNS records won't be a problem for all websites anyway (depending on how you do your hosting and if you use a static content subdomain). The difficulties with naked domains in some forms of communication however, will be something to carefully think about for all types of websites. For larger websites, or smaller sites which grow quickly, I would always go for a domain with www, this will give you less potential issues as your site continues to grow (when you switch your hosting provider or start using a static content subdomain). Furthermore www domains are currently used by most large sites (Google, Facebook, amongst others). For small websites (like this one) the issues with naked domains will usually not apply so you just have to go with your personal preference. In the end the thing that matters most is that you make a choice. Pick a preferred domain (naked or not) an redirect all other domain versions to this preferred domain.