3

I remember reading that it is better to use www.example.com instead of example.com on a web server when setting up web sites. Why, exactly, is this the case? I am asking from a network admin POV.

4 Answers 4

14

One may use a domain name for many different types of services. www signifies you serve web pages. But you may think of others, such as ftp, news, nntp, smtp, imap, snmp, ntp... as in the following example list (not complete by any means):

ftp                     File Transfer protocol
http                    Hypertext Transfer Protocol
gopher                  The Gopher protocol
mailto                  Electronic mail address
news                    USENET news
nntp                    USENET news using NNTP access
telnet                  Reference to interactive sessions
wais                    Wide Area Information Servers
prospero                Prospero Directory Service

These all are associated to different ports and could live on the same server, but the convention is to split them and at least associate them to notionally different (logical) servers, this allows you to actually split them to different physical servers should you need to (for example your www now needs more space, but other services are fine, so you move the logical server to a new physical server).

One way to split them is to give them different subdomain names, hence the www and the like. You can of course use an intelligent loadbalancer that will split and forward your traffic based on criteria such as destination port numbers and other considerations, in this case you will not need the subdomain scheme. But subdomains do make it clear and easy to identify what's what.

In fact you can use any subdomain name you care to think about (providing you remain within the allowed range of characters and length limits), but this could be confusing to your customers.

It is common that modern websites equate the www prefixed domain with the one without prefix - i.e. they both direct your website users to the same web pages.

4

Its typical to have both with www, and without configured.

1

Saying one is better than the other without explaining why is very subjective. Basically using www is a subdomain of your domain name, and as such gives you an extra set of handles to work with when configuring DNS so that conceivable the handling of the www domain could be passwed of to a load balancer or other such monkey business.

In practice for most small sites, DNS already allows enough freedom to specify various services such as mail to be hosted separatly anyway that the distinction is not meaning full and using the root of your domain as the place you host your website is perfectly acceptable.

It should be noticed that it IS advisable to choose one or the other as canonical and redirect your users to the one you want to use. This will avoid mix-and-match data in search engine indexes and confusion over cookie accesability, visitor statitics, etc.

I generally prefer to use example.com as canonical, but I also have to be aware that many visitors will specifically type in the www. and so I always host that sub-domain as an alias of the canonical plain domain name, then use a rewrite to put them where they should have been to start with. Either way, you will always have some people that type in your address with or without the www when you prefer to other way, so be prepared to handle it.

0

I don't think that it's necessarily "better" to have one or the other. In fact, unless you need example.com to be on a different host somewhere, I'd use both to be user-friendly.

Not the answer you're looking for? Browse other questions tagged .