Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
www.example.com vs example.com

Is there any particular reason that "www." is required for some websites? It seems to me that all this does is cause inconvenience (at best) and confusion.

For example, http://math.cmu.edu gives a "Server not found" error, but http://www.math.cmu.edu takes you to the right place. Also, on HD Nation (Revision 3) they advertise for Netflix, but warn that you need to include "www." for the show-specific URL and discount to count.

share|improve this question
    
Holy war? Hmm... –  Andrew Keeton Aug 24 '09 at 21:27
    
/me suspects Chris_K is trying to get the taxonomist badge... –  Andrew Keeton Aug 24 '09 at 21:28
3  
This is a legit question, one many people might wonder about for their own website. –  Mark Henderson Aug 24 '09 at 21:29
    
It is indeed a legit question. But I've seen similar questions (elsewhere) devolve rather quickly... (and I was curious to see if I could add tags cough) –  Chris_K Aug 24 '09 at 21:30
1  
Well if you click on the [www] tag you can see 2 dupes. This is one: serverfault.com/questions/38387/www-example-com-vs-example-com –  EBGreen Aug 24 '09 at 21:31
add comment

marked as duplicate by splattne Aug 25 '09 at 8:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4 Answers

up vote 10 down vote accepted

It depends on how DNS is setup. If they do not have an A (or host) record at math.cmu.edu pointed at the IP of the web server, then the site will be inaccessible without adding the "www" in front.

There is no standard that says a site needs to be accessible without the "www", but it has been a common practice for a long time since the web is so prevalent.

share|improve this answer
    
i would not reference "www" out of spite for a term that should have been abandoned long ago... –  djangofan Aug 24 '09 at 21:53
    
Actually, it doesn't have to be an A record. CNAME will work just fine too. However, it could still not work, even with the DNS configured properly, if the web server is configured to serve for name-based virtual hosts and the name without "www" is not configured. –  af. Aug 24 '09 at 22:45
add comment

There is a VERY good reason why WWW exists for domain names, and it is: cookies!

If you set a cookie on example.com then it is accessible from www.example.com, but also from admin.example.com and images.example.com. By accessing your website through www.example.com and setting cookies for www.example.com that means that your cookies are not going to be passed to admin.example.com.

Sometimes you want this. Sometimes you don't. You need to decide straight up if you need cookies accessed across subdomains on your site.

Case in point, we started running our website on www.example.com. When they needed to add SSL to the website, some smart cookie decided to put the SSL on secure.example.com. Now when users move from www.example.com to secure.example.com their cookie is lost and so is their login information.

That said, I can't see any good reason why you would have www.secure.example.com

share|improve this answer
    
the solution in your example above is to either do what sane people do and reconfigure the web server to allow both http and https on www.example.com, or to run the ssl on secure.www.example.com (with cookies on www.example.com shared with all subdomains of www.example.com) –  cas Aug 24 '09 at 21:42
2  
secure.www.example.com? Yuch, I can see the question now: "Why does this website use secure.www.example.com?" Anyway, who said anything about sanity? Hehe I've actually asked a few questions on here about how to separate ourselves from the guy who did this to us... –  Mark Henderson Aug 24 '09 at 21:47
    
well, now you have two viable solutions. enjoy :) –  cas Aug 24 '09 at 21:49
add comment

there is no reason. domain names are arbitrary (although there are some well-known conventions like www. for webservers, ftp. for ftp servers, mail. or smtp. or mx. for mail servers etc).

www.example.com and example.com may refer to the same machine (via A records or CNAME) or they may point to completely different machines.

in the latter case, the only way to have http://example.com/ and http://www.example.com/ get to the same site is to have a httpd running on example.com that issues a redirect to www.example.com

(it's not unusual for this redirection to occur even when two or more domains point to the same site & machine - e.g. apache's "UseCanonicalName on" and mod_rewrite to redirect requests for the non-canonical name to the canonical name for the site)

share|improve this answer
    
There is a common misconception that www is the standard for a website. In reality it is just a commonly adopted convention. In this particular case, quite clearly the DNS isn't pointing the base domain (math.cmu.edu) to a server running a web service, which is why you get the error message, whereas www.math.cmu.edu is pointing to a running web server. I am amazed at how often this gets overlooked by web masters. –  wolfgangsz Aug 24 '09 at 23:38
    
It IS a "standard" (as in commonly adopted convention) - just not a technological standard such as those put out by ISO or IEEE. As a side note, browsers often attempt to add a "www." prefix if the page is not found, and a ".com" suffix... You're right though: it is a commonly adopted convention in truth. –  David Aug 25 '09 at 0:56
add comment

Because that's how they set up their webserver.

Edited to add:

You don't need to do it this way for your own server. In fact, you can use whatever hostname you like. But www is pretty common and kind of a defacto standard among users.

Alternatively, they may have already used the @ record for the domain for something else, and can't change it for that reason.

share|improve this answer
    
It's probably DNS. –  Bill Weiss Aug 24 '09 at 21:35
add comment

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