Mobile app version of vmapp.org
Login or Join
Sent6035632

: Should I include "www" in my canonical URLs? What are the pros and cons? What are the pros and cons of having http://www.example.com/ vs http://example.com/? For example a problem I'm aware of

@Sent6035632

Posted in: #Domains #NoWww #Subdomain #Url

What are the pros and cons of having www.example.com/ vs example.com/?
For example a problem I'm aware of is that if I use a domain without www I can't set a cookie for the current subdomain only (since there is no subdomain), and the cookies I set will be sent to all subdomains.

10.08% popularity Vote Up Vote Down


Login to follow query

More posts by @Sent6035632

7 Comments

Sorted by latest first Latest Oldest Best

 

@Murray432

Yes, always use www instead of a naked domain. Although Heroku is somewhat specialized, the kind of routing fabric they've built is likely going to become more common as people deploy websites across clusters of machines. Naked domains are just much less flexible than www because they require an A instead of a CNAME record. See devcenter.heroku.com/articles/avoiding-naked-domains-dns-arecords.
Although you might not think so today, every site on the web should and hopefully soon will be using SSL all the time. That's because security is always better than no security, and the costs of SSL are already only ~1% additional CPU (see www.imperialviolet.org/2010/06/25/overclocking-ssl.html). You should get your SSL certificate for www as well.

10% popularity Vote Up Vote Down


 

@Jamie184

Without repeating the valid answers above regarding cookies, aesthetics, non-technical users expecting the www subdomain etc...

Another reason I tend to favour the subdomain approach for the main site is for local development. I use local. for my local test server. I always expect the site to be accessed via a subdomain and can easily distinguish between the test and live sites if required. Cookies can be kept separate from the local and live sites.

example.com Live site
local.example.com Local test server


Using a subdomain for the test server also allows easy testing from a mobile device, since the subdomain can be defined in the public DNS that points to a local test server (local IP). Only when the mobile device is on the local WiFi network will it be able to access the local test server. (Make sure that mobile browser optimisations are disabled when connecting locally, otherwise the remote optimisation server will also try to access your local server and fail.)

10% popularity Vote Up Vote Down


 

@Angela700

This is a minor consideration but one that is relevant for commercial sites. There is an expectation from non-technical users that a website starts with www so when they don't see that they might not think of a domain as a website.

Whilst it may seem silly to those of us that know how things work I have come across this attitude frequently with family, friends and non-technical colleagues and these people are likely to represent the vast majority of your customers.

Additionally, a lot of software such as email, world processors, social networking clients & co will automatically recognise a domain name starting with www as a hyperlink and make it active - with a naked, or non-www, domain you will need to add the for the software to make it active. Being able to click a link instead of having to copy-paste into a browser could make the difference between a customer visiting your site or going to your competitor.

10% popularity Vote Up Vote Down


 

@Sent6035632

Including the www subdomain seems to boil down to two conditions:


Cookies - Will setting cookies at *.example.com cause me grief (incur more traffic) because the cookies will be sent with every request, regardless of subdomain. In this case I would opt to use the www since it gives me the choice of setting cookies at *.example.com if I need it (ex. authenticated user cookie), or example.com to reduce traffic to my other subdomains.
Aesthetic - Do I care a lot about how the domain looks? If I really hate the www but am worried about the cookie traffic, I could alleviate the problem by hosting my static content on a whole new domain such as static-example.com which would remain cookie free.

10% popularity Vote Up Vote Down


 

@Michele947

Keep in mind though that using example.com lets you to set Cookies only on the main site. Using example.com will only allow you to set cookies on *.example.com which includes static.example.com. So every request for any subdomain will include the cookies which slows down the transfer a bit. Using example.com will allow you to decide for what part you want to set cookies.

10% popularity Vote Up Vote Down


 

@Rivera981

If you are going to use example.com, you should make example.com a permanent re-direct to example.com.
The www sub domain, in some cases, is actually a completely different server than the parent TLD. While most search engines are smart enough to figure that out, its still good practice to place the re-direct.

I'm the complete reverse of that, example.com is a permanent redirect to example.com, because I prefer using the shorter canonical URL. It also make sense to me that I can expect a HTTP request to example.com will yield a web page, or a redirect to whatever subdomain is dealing with HTTP requests.

Additionally, you want people linking to your site using the canonical URL, which is the one they pick out of their browser toolbar. The re-direct on the one that is NOT your canonical URL helps ensure consistency in that regard.

10% popularity Vote Up Vote Down


 

@Carla537

There doesn't seem to be any concrete reasons for using one over the other as far as search results or other desired outcomes. My personal preference is no-www, due to length.

The most important thing is to make sure you redirect to your preferred domain, and remember to set your preferred domain in Google Search Console (Google Webmaster Tools).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme