Should I include "www" in my website's URLs? What are the pros and cons?
Keep in mind though that using www.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 www.example.com
will allow you to decide for what part you want to set cookies.
If you are going to use www.example.com
, you should make example.com
a permanent re-direct to www.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, www.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.
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 thewww
since it gives me the choice of setting cookies at*.example.com
if I need it (ex. authenticated user cookie), orwww.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 asstatic-example.com
which would remain cookie free.