Should I include "www" in my website's URLs? What are the pros and cons?
Solution 1
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.
Solution 2
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.
Solution 3
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.
Solution 4
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 http://
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.
Solution 5
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).
Related videos on Youtube
epascarello
Updated on September 17, 2022Comments
-
epascarello over 1 year
What are the pros and cons of having
http://www.example.com/
vshttp://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.-
Admin about 11 years@John Conde: I think the edit you approved made the question worse.. "My question is fairly simple to complex and want to know the in's and outs of www vs non-www." was edited in, which is broken english and doesn't make sense in any case.
-
-
Greg Bray almost 14 yearsThis is one of the big reasons why large websites setup completely separate domains for static content (such as sstatic.net for Stack Overflow) so that they have cookie-free domains. More info here: developer.yahoo.com/performance/rules.html#cookie_free
-
McDowell almost 14 yearsyes this is the biggest downside of the "no-www" movement, by far. It is definitely annoying.
-
DisgruntledGoat almost 14 years@Jeff: True to an extent, but it can be more beneficial to host static content on a different domain anyway, to increase parallelization.
-
DisgruntledGoat almost 14 yearsActually I see a lot of advertising for domain names without the www. For example the BBC always quote their URL as
bbc.co.uk/whatever
when they always redirect to the www version. -
Kristian Damian over 13 years+1 I totally agree on your minor consideration. It's true there is definitely "an expectation from non-technical users that a website starts with www" and it's also true: "so when they don't see that they might not think of a domain as a website". It sounds odd for tech users like us, but that's life.
-
Kristian Damian over 13 years@DisgruntledGoat: the parallelization is increased also using subdomains! developer.yahoo.com/performance/rules.html#split
-
Alex MacCaw over 13 yearsTypically, if the URL doesn't start with www, I include
http://
at the front. So if the URL ishttp://www.example.com
, then I often just usewww.example.com
. If it washttp://other.example.com
, then I would usehttp://other.example.com
. Otherwise, users don't realize it is a URL. Sounds crazy, but people mix up URLs and e-mail addresses all the time now. Sadly, we have dumbed-down things so much on the web, that our users don't know the basics any more. -
Nick almost 12 years1. If you want to create a CNAME that maps the subdomain
www.
toexample.ec2.amazonaws.com
. You can't do that with a naked domain. 2. Typing a domain name in the address bar and hittingCTRL + ENTER
it automatically enclose the text withhttp://www.
and.com
. Having your permanent domain with a www prefix will prevent unnecessary redirection. 3. Typing inexample.com
under windowsstart + run
will result in an error. -
Admin about 11 yearsThis is very dubious.
-
Admin about 11 yearsYou can't do this because Blogger hosting on a custom domain is done using a CNAME to ghs.google.com, and the naked domain can't be a CNAME.
-
Derecho about 11 yearsThis answer is becoming obsolete now that RFC 6265 is more widely implemented. (It did not exist at the time this answer was written, though.)
-
Cornelius about 11 yearsActually, what we did was expand the reach of the internet to people who never were educated in that regard. Ten years ago, you basically only got nerds on the internet. (Exaggeration.) Nowadays almost literally everyone uses facebook, google, "the internet". How many people are out there not knowing how a car works. Or a percolator. Or typesetting. (With varying degrees of relevancy.)
-
Adelin about 2 yearsmeaning that one should use example.com not www.example.com?