Chances are you’ve stumbled across this page because you’re looking for information about whether or not you should use www in your canonical URLs. We’ll help you with that.
First up, a quick explanation: sometimes a domain without the www is referred to as a naked domain, and we’ll refer to it as such in this post.
Why should I use www?
If you’re reading this, the likelihood is you’re the webmaster of a small(ish) website, but you want to take things up a notch. You’re interested in gauging performance, and want the best for your platform.
The technical reasons for using www typically apply to larger websites (those that receive millions of views per day), sites with a large number of services across several subdomains, and virtually any site hosted in the cloud by a service provider.
But who doesn’t want their site to sit in this category?
Another reason has to do with cookies. One common optimisation is to serve static content from a subdomain, such as static.example.com. If you are using www, then you’ll have no problem; cookies won’t be sent to the static subdomain, unless you explicitly set them up to do so.
If you use the naked domain, cookies get sent to all subdomains – slowing down access to static content, and possibly causing caching to not work properly. The only way to get around this and keep the naked domain is to buy a second domain name just for your static content. Twitter, for instance, which does not use www, had to buy new domain names just for static content.
Of course, if you explicitly share cookies across your subdomains, for instance to implement single sign-on across various services on subdomains of your site (Google does this), then you’d have to buy a new domain anyway.
If you decide to use a naked domain, but want to put services on subdomains and share cookies between them, you’ll quickly find out that it doesn’t work in all cases unless you have a subdomain set the cookie, and then it doesn’t work for the naked domain.
You may not run into any of these issues, but as your website grows, you could. Adopting www today makes you more prepared to handle the challenges of growing a site beyond a single server. Don’t get us wrong, it can be done without using www, but it’s much easier with.
One last thing, should I redirect naked domain URLs to www?
Simply put, yes.
Redirection ensures that visitors who type in your URL reach you regardless of which form they use, and also ensures that search engines index your canonical URLs properly.