89

From technical perspective the only issue is traffic and incoming links (one of them should redirect to another).

Now I need to choose which one should be primary. Some sites have www (google, microsoft, ruby-lang) and some without www (stackoverflow, github). Seems to me the newer do not use WWW.

What to choose?

Please with some explanations.

UPDATE: This is programming related question. Actually site is for programmers, so I expect to see what techy people think.

UPDATE: Site without WWW is clear winner. Thank you guys!

Mike Chaliy
  • 25,801
  • 18
  • 67
  • 105
  • 7
    To me, h t t p : / / w w w seems really redundant. www implies the traffic will be through HTTP... which h t t p : / / already tells you. – Travis Jul 10 '09 at 13:48
  • 5
    you can never have a cookie-less subdomain (think CDN) if you choose the no-www route. http://www.phpied.com/www-vs-no-www-and-cookies/ – Neil McGuigan Nov 29 '12 at 04:52
  • 1
    [This answer](http://stackoverflow.com/a/385280/812102), though not directly related, seems relevant. Also, don't forget to read [what’s the point in having “www” in a URL?](http://serverfault.com/questions/145777/what-s-the-point-in-having-www-in-a-url). – Skippy le Grand Gourou Feb 18 '15 at 21:48
  • 2
    http://www.yes-www.org/why-use-www/ – Vic Jun 23 '16 at 17:13

14 Answers14

65

It doesn't matter which you choose but you should pick one and be consistent. It is more a matter of style but it is important to note that search engines consider these two URLs to be different sites:

http://www.example.com
http://example.com

So whichever you choose for aesthetic reasons should be consistently used for SEO reasons.

Edit: My personal opinion is to forgo the www as it feels archaic to me. I also like shorter URLs. If it were up to me I would redirect all traffic from www.example.com to example.com.

Andrew Hare
  • 344,730
  • 71
  • 640
  • 635
  • 10
    It's also useful to have a single canonical domain so cookies don't get lost, which really confuses users – Adam Batkin Jul 10 '09 at 12:59
  • 5
    Plus, if you chose one as canonical, accept the other but redirect it to avoid duplicate content from the search engines point of view. – instanceof me Jul 10 '09 at 13:04
  • I need to choose :). So this answer could not help me :). I am aware about CEO issues, I have otilned this in question. – Mike Chaliy Jul 10 '09 at 13:06
  • 11
    @Mike - I don't think you meant CEO issues - those would be when the Chief Exec has a fit because "all websites must start with WWW!" ;) – Keith Williams Jul 13 '09 at 12:57
  • 2
    http://stackoverflow.com/questions/2919394/whats-the-point-in-having-www-in-a-url – Quintin Par May 27 '10 at 08:16
  • if you had a friend named google, and he decided to jump off a bridge, would you do it ; ) http://google.com – random-forest-cat Dec 13 '13 at 02:44
  • It should also be noted that some browsers append the www automatically. I'm not sure if Firefox still does it, but it used to need to be disabled in the configuration. – None Jan 14 '14 at 19:36
  • `www` has the advantage to be "universal" so lambda people reading a website address like `mydomain.tld` can be confused while he will understand that `www.mydomain.tld` is a website address, especially with all these new tld. – Seb33300 Sep 11 '14 at 16:16
  • this provides many more arguments in favor of ``www`` than thos agains it http://www.yes-www.org/why-use-www/ – Vic Jun 23 '16 at 17:13
21

Don't use WWW. It's an unnecessary tongue-twister, and a pain in the arse for graphic designers.

Keith Williams
  • 2,257
  • 3
  • 19
  • 29
  • 8
    What problems does it cause graphic designers? – StuperUser Jul 10 '09 at 13:07
  • I guess they should add WWW to the logo's, otherwise users will be confused, same could be true for ads. – Mike Chaliy Jul 10 '09 at 13:11
  • 7
    @StuperUser - it's just noise on the logo; the pattern of the Ws is quite visually distracting. @Mike - I think mysite.com is obviously a website, with or without WWW. People will still *type* the WWW, which is why you configure both on the server, but telling someone to go to "bbc.co.uk/news" is just as understandable as "www.bbc.co.uk/news" – Keith Williams Jul 13 '09 at 12:56
  • 1
    *Some* people will still type the www. Some won't. And then there are some people who type the `http://` at the start even though that is never a necessary thing to type. And then there are people who type `http://www.google.com/`, wait for google to come up, then type `http://www.yoursite.com/` into Google. Long story short, you need to support both www and no www, regardless of which is your "primary". It's also a good idea to always buy the ".com" as well even if your primary is a ".net" or ".org", etc. Some people will automatically put ".com" when typing any web address. – thomasrutter Jan 28 '14 at 04:26
18

There are some issues you should consider. See for example Use Cookie-free Domains for Components for a cookie validity issue.

But regardless of how you decide: Use just one of that domains as your canonical domain name and use a 301 redirect to correct the invalid. For an Apache webserver, you can use mod_rewrite to do that.

Gumbo
  • 643,351
  • 109
  • 780
  • 844
15

Configure both, obviously. I would make the www redirect to the normal URL, as it only exists to make the people who habitually type it at the beginning of every address happy anyway. Just don't, whatever you do, require the www to be typed manually. Ever.

thomasrutter
  • 114,488
  • 30
  • 148
  • 167
Lucas Jones
  • 19,767
  • 8
  • 75
  • 88
12

It depends on your audience, I think. A non-technical audience will assume that the www is there, whereas a technical audience will not instinctively expect it, and will appreciate the shorter URLs.

(Edit: I recently set up a domain for my family to use, including webmail. My wife asked what the address of the webmail was. I said "mail.ourdomain.com". She typed "www.mail.ourdomain.com".)

Either way, make sure the one you don't use cleanly does a 301 Redirect to the one you do use - then neither users nor search engines will need to care.

RichieHindle
  • 272,464
  • 47
  • 358
  • 399
  • 1
    I agree that audience is important to consider. But people need to be weened off it by having www redirect to non-www so that a non-technical audience can still type the www, but hopefully notices that the URL drops it. Or you could be an asshole like I am on my personal site and forward www to http://no-www.org. – None Jan 14 '14 at 17:19
  • 1
    no-www.org is such a good idea - I only wish its design was a little more user-friendly. It probably just looks like a wall of gobbeldygook (11pt courier new, like you know, "view source") to non-technical people. – thomasrutter Jan 28 '14 at 04:31
11

One aspect of this question deals with CDNs and some web hosts (eg. Google Sites). Such hosts require that you add a CNAME record for your site name that points to the host servers. However, due to the way DNS is designed, CNAME records cannot coexist with other records for the same name, such as NS or SOA records. So, you cannot add a CNAME for your example.com name, and must instead add the CNAME for a subdomain. Of course people normally choose "www" for their subdomain.

Despite this technical limitation, I prefer to omit the www on my sites where possible.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • 2
    As far I know this is not true, you can use "example.com." (did you noticied dot after domain name?). – Mike Chaliy Jul 10 '09 at 13:09
  • 1
    I see the dot, but I think you'll find that from the point of view of DNS, "example.com" and "example.com." are treated the same and you still can't add a CNAME record for either of them. – Greg Hewgill Jul 10 '09 at 13:13
  • 1
    May be this depends on implementations, but this is exactly how I did this with heroku hosting. Check out - http://onticoren.com/2009/06/29/go-daddy-dns-heroku/ – Mike Chaliy Jul 10 '09 at 13:36
  • I think it is also worth to mention that CNAME records cannot coexist with MX records used for e-mail, as explained in [RFC 1912](https://tools.ietf.org/html/rfc1912) section 2.4 ("A CNAME record is not allowed to coexist with any other data. In other words, if suzy.podunk.xx is an alias for sue.podunk.xx, you can't also have an MX record for suzy.podunk.edu, or an A record, or even a TXT record.") and in [this article](https://www.netlify.com/blog/2017/02/28/to-www-or-not-www/). What is the reason for this technical limitation? – Géry Ogam Apr 25 '20 at 12:24
10

I'd redirect to without www. In Apache 2.x:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$
RewriteRule (.*) http://yourdomain.com/$1 [R=Permanent] 

I think the www is meaningless; we all know we're on the world wide web. It would be much better to use subdomains for load balancing or for device specific sites (like m.google.com for mobiles, for example, even though there is a .mobi top level domain now).

Gav
  • 11,062
  • 7
  • 33
  • 35
8

www is used as a standard sub domain, subfolder for websites in the main domain.

http://no-www.org/ are trying to get it deprecated.

Although http://www.w3.org/ include www.

Worth checking both those sites.

It seems to be become a matter of taste and a religion issue at the moment rather than a standard. Whatever you choose, make sure you register or redirect from www as Control+enter etc. shortcuts copy in www.

StuperUser
  • 10,555
  • 13
  • 78
  • 137
6

Would you have other subdomains? If so, that may make using the www make more sense to my mind as some places may have various subdomains used for other purposes like a store or internationalization subdomains.

JB King
  • 11,860
  • 4
  • 38
  • 49
  • To me it makes sense that a co.'s domain without providing a device name, i.e. no-www, would go to a page with info about that domain and perhaps navigation to the various device names within that domain. Would you ever not want to show a website if no subdomain is specified? Or want more than one FQDN to go to the same place? Or to have your default domain point to a device other than www? I would be confused if example.com were, say, ftp, and you had to type www.example.com to get to the world wide web. Right now redirecting www to non-www is temporary until www is gone altogether. – None Jan 14 '14 at 17:49
5

I normally go with www.sitename.com because it is explicit that it is the main part of your site. Testing.sitename.com is testing. House.sitename.com is my home PC. I like be explicit however I do not mind when sites do not use www. I am not a purest. :)

Tony
  • 1,684
  • 1
  • 18
  • 29
3

Use without the www. The general rationale behind this is that since you are writing an address to a web browser, it's already implicit that you are accessing a web site (what else would you do with a browser?) - using the extra www is therefore useless.

To be specific, when receiving a http request, you know the user wants to access the website. The web browser adds the http://-header implicitly, so user only needs to worry about the address. Same goes to other services as well - if you host ftp, it should be enough to point the ftp client to the domain without the ftp. -prefix.

If I understand correctly, the reasons for using the different www., ftp., etc. subdomains are mostly historical, and are no longer relevant these days since traffic is simply directed to the correct server/service - the redundant prefixes have just stuck because of their popularity.

Ilari Kajaste
  • 3,207
  • 2
  • 23
  • 25
  • You can type a domain into more things than just a web browser. It just makes sense that no subdomain defaults to the web since it is accessed by the public the most. – None Jan 14 '14 at 17:57
2

I always make the non-www one redirect to www and refer to them as www.mysite; Think about various forums and instant messenging apps that correctly convert links only when they begin with www. .

foxx1337
  • 1,859
  • 3
  • 19
  • 23
  • 2
    then type it as http://sitename.com - this will get picked up fine and will actually work in MORE cases. – tomfanning Jul 10 '09 at 13:11
  • 3
    SO picked up what I typed and converted it to a link :-) proving my point. h t t p : / / sitename .com – tomfanning Jul 10 '09 at 13:11
  • @tomfanning: come.to/foobar. Just checking what happens. – Salman A Apr 05 '11 at 12:43
  • @tomfanning @Salman Links begin with a protocol such as `http://` or `ftp://` not www. www is assumed to be hypertext transfer protocol, but that is a good point I never had considered... although it can easily be avoided by including the protocol in your link. – None Jan 14 '14 at 18:02
2

You want your url to be memorable, and you want Google et al to register the same url for rankings and the like.

Best practice appears to be to handle the www, but always HTTP redirect it to a non-www variant. That way the search engines know to rank links to both variants as the same site.

Keith
  • 150,284
  • 78
  • 298
  • 434
1

Whatever you use, stick to one or else you'll have to make 2 sets of cookies for each domain to make your sessions/cookies work properly.

Adam Fowler
  • 1,750
  • 1
  • 17
  • 18