Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

What are the pros and cons of having http://www.example.com/ vs http://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.

share|improve this question
    
@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. –  Andreas Bonini Feb 15 '13 at 15:20

8 Answers 8

up vote 48 down vote accepted

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.

share|improve this answer
6  
Excellent point, one I had not considered. –  tnorthcutt Jul 9 '10 at 14:35
5  
This 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 –  Greg Bray Jul 10 '10 at 21:23
7  
yes this is the biggest downside of the "no-www" movement, by far. It is definitely annoying. –  Jeff Atwood Jul 11 '10 at 3:32
    
@Jeff: True to an extent, but it can be more beneficial to host static content on a different domain anyway, to increase parallelization. –  DisgruntledGoat Jul 12 '10 at 21:04
3  
@DisgruntledGoat: the parallelization is increased also using subdomains! developer.yahoo.com/performance/rules.html#split –  Marco Demaio Aug 27 '10 at 15:19

If you are going to use www.domain.com, you should make domain.com a permanent re-direct to www.domain.com.

The www subomain, 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.mydomain.com is a permanent redirect to mydomain.com, because I prefer using the shorter canonical URL. It also make sense to me that I can expect a HTTP request to foo.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.

share|improve this answer

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

  1. 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 *.exmaple.com if I need it (ex. authenticated user cookie), or www.example.com to reduce traffic to my other subdomains.

  2. 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.

share|improve this answer

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 automagically 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.

share|improve this answer
    
Actually 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. –  DisgruntledGoat Jul 12 '10 at 21:07
    
+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. –  Marco Demaio Aug 27 '10 at 13:43
    
Typically, if the URL doesn't start with www, I include http:// at the front. So if the URL is http://www.something.com, then I often just use www.something.com. If it was http://other.something.com, then I would use http://other.something.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 anymore. –  Brad Dec 2 '10 at 14:50
    
Actually, 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.) –  Cornelius Apr 17 '13 at 15:52

There don'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 Webmaster Tools.

share|improve this answer

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

Another reason I tend to favour the www. 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 reqd. Cookies can be kept separate from the local and live sites.

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

share|improve this answer

My SEO people tell me Google doesn't like naked domains. A symptom of this is that if you try to redirect your myblog.blogspot.com blog to mypersonaldom.com/blog, you get an error that says Blogs cannot be hosted at naked domains.

I'll provide more details when I get them.

share|improve this answer
    
This is very dubious. –  Lèse majesté Feb 15 '13 at 1:28
1  
You 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. –  Michael Hampton Apr 16 '13 at 3:17
    
Techincally, naked domains can be CNAME but it breaks mail delivery as all mail gets delivered to that CNAME as well instead of to the MX records. –  Stephen Ostermiller Aug 8 '13 at 12:47

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 https://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 http://www.imperialviolet.org/2010/06/25/overclocking-ssl.html). You should get your SSL certificate for www as well.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.