tags:

views:

540

answers:

9

I've been trying to collect analytics for my website and realized that Google analytics was not setup to capture data for visitors to www.example.com (it was only setup for example.com). I noticed that many sites will redirect me to www.example.com when I type only example.com. However, stackoverflow does exactly the opposite (redirects www.stackoverflow.com to just stackoverflow.com).

So, I've decided that in order to get accurate analytics, I should have my web server redirect all users to either www.example.com, or example.com. Is there a reason to do one or the other? Is it purely personal preference? What's the deal with www? I never type it in when I type domains in my browser.

+5  A: 

It's just a subdomain based on tradition, really. There's no point of it if you don't like it, and it wastes typing time as well. I like http://somedomain.com more that http://www.somedomain.com for my sites.

Alex Fort
just to add info, yes the name can be anything and the www was used historically to differentiate from servers on the same domain providing mail/ftp/etc. I type it where needed :) Nowadays many people even expect www to be there, even if it isn't
John Ferguson
+5  A: 

Also, skipping the “www.” saves you four bytes on each request. :)

Bombe
+4  A: 

Jeff has an interesting post about WWW at his blog.

Robert S.
+1 yes its waste time :)
ktutnik
+1  A: 

It's primarily a matter of establishing indirection for hostnames. If you want to be able to change where www.example.com points without affecting where example.com points, this matters. This was more likely to be useful when the web was younger, and the "www" helped make it clear why the box existed. These days, many, many domains exist largely to serve web content, and the example.com record all but has to point to the HTTP server anyway, since people will blindly omit the www. (Just this week I was horrified when I tried going to a site someone had mentioned, only to find that it didn't work when I omitted the www, or when I accidentally added a trailing dot after the TLD.)

Omitting the "www" is very Web 2.0 Adoptr Gamma... but with good reason. If people only go to your site for the web content, why keep re-adding the www? I general, I'd drop it.

rjbs
+3  A: 

http://no-www.org/

Google Analytics should work just fine with or without a www subdomain, though. Plenty of sites using GA successfully that don't force either/or.

ceejayoz
+25  A: 

History lesson.

There was a time when the Web did not dominate the Internet. An organisation with a domain (e.g. my university, aston.ac.uk) would typically have several hostnames set up for various services: gopher.aston.ac.uk, news.aston.ac.uk, ftp.aston.ac.uk. They were just the obvious names for accessing those services.

When HTTP came along, the convention became to give the web server the hostname "www". The convention was so widespread, that some people came to believe that the "www" part actually told the client what protocol to use.

That convention remains popular today, and it does make some amount of sense. However it's not technically required.

I think Slashdot was one of the first web sites to decide to use a www-less URL. Their head man Rob Malda refers to "TCWWW" - "The Cursed WWW" - when press articles include "www" in his URL. I guess that for a site like Slashdot which is primarily a web site to a strong degree, "www" in the URL is redundant.

You may choose whichever you like as the canonical address. But do be consistent. Redirecting from other forms to the canonical form is good practice.

slim
Completely off-topic but how do you like Aston? I'm trying to decide whether to put Aston or Plymouth as my second choice for CS :-)
Ross
I was there over ten years ago - I really don't know what it's like nowadays. I do know my favourite lecturer when I was there (Peter Coxhead) is now at Birmingham Uni. There are a lot of familiar names on the staff roll though.
slim
Excellent post slim!
Bjørn
Still waiting for "gopher.slashdot.org"...
Ken
A: 

Let alone the URL already specifies what protocol is to be used so "www." is really of no use.

As far as I remember, in former times services like www and ftp were located on different machines, therefore using the natural DNS features (subdomains) was necessary at this time (more or less).

codethief
A: 

It is the third-level domain (see Domain name. There was a time where it designated a physical server: some sites used URLs like www1.foo.com, www3.foo.com and so on.

Now, it is more virtual (different 3rd-level domains pointing to same server, same URL handled by different servers), but it is often used to handle sub-domains, and with some trick, you can even handle an infinite number of sub-domains: see, precisely, Wikipedia which uses this level for the language (en.wikipedia.org, fr.wikipedia.org and so on) or others site to give friendly URLs to their users (eg. my page http://PhiLho.deviantART.com).

So the www. isn't just here for decoration, it has a purpose, even if the vast majority of sites just stick to this default, and if not provided, supply it automatically. I knew some sites forgetting to redirect, giving an error if you omitted it, while they communicated on the www-less URL: they expected users to supply it automatically!

PhiLho
+2  A: 

It's important to be aware that if you don't use a www (or some other subdomain) then all cookies will be submitted to every subdomain amd you won't be able to have a cookie-less subdomain for serving static content thus reducing the amount of data sent back and forth between the browser and the server. Something you might later come to regret.

(On the other hand, authenticating users across subdomains becomes harder.)

Sam Hasler