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!

4

14 Answers 14

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.

9
  • 10
    It's also useful to have a single canonical domain so cookies don't get lost, which really confuses users Jul 10, 2009 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. Jul 10, 2009 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. Jul 10, 2009 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!" ;) Jul 13, 2009 at 12:57
  • 2
21

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

4
  • 8
    What problems does it cause graphic designers?
    – StuperUser
    Jul 10, 2009 at 13:07
  • I guess they should add WWW to the logo's, otherwise users will be confused, same could be true for ads. Jul 10, 2009 at 13:11
  • 6
    @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" Jul 13, 2009 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. Jan 28, 2014 at 4: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.

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.

3
  • 17
    You don't include the "www" when registering domain names. The "www" is a subdomain. Jul 10, 2009 at 13:00
  • 6
    Also, if you have a https certificate, don't forget to register it for both www, and non-www. Jul 10, 2009 at 13:01
  • 5
    @John I think he meant register them in your app server. Jul 10, 2009 at 13:02
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.

2
  • 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 no-www.org.
    – None
    Jan 14, 2014 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. Jan 28, 2014 at 4: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.

4
  • 2
    As far I know this is not true, you can use "example.com." (did you noticied dot after domain name?). Jul 10, 2009 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. Jul 10, 2009 at 13:13
  • 1
    May be this depends on implementations, but this is exactly how I did this with heroku hosting. Check out - onticoren.com/2009/06/29/go-daddy-dns-heroku Jul 10, 2009 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 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. What is the reason for this technical limitation?
    – Géry Ogam
    Apr 25, 2020 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).

1
  • 5
    I am interesting why you redirect not how... Jul 10, 2009 at 13:00
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.

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

1
  • 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, 2014 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. :)

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.

1
  • 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, 2014 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. .

4
  • 2
    then type it as sitename.com - this will get picked up fine and will actually work in MORE cases.
    – tomfanning
    Jul 10, 2009 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, 2009 at 13:11
  • @tomfanning: come.to/foobar. Just checking what happens.
    – Salman A
    Apr 5, 2011 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, 2014 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.

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.

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