WebSites with an without “www”

Will your clients find your site when they type http://yourdomain.com and http://www.yourdomain.com? Is it crucial to have both versions (with and without “www”)?

We think it is as it increases the chance that your web site will be found. Some people will just type your company name appended with “.com” and hope to find your site. However many web hosting companies only configure their DNS (Domain Name Servers) to route requests for www.yourdomain.com to your web site. In order to have both versions accessible, the DNS-Master (the person in charge of the DNS system) needs to make a few minor changes to the setup whereby the DNS zone (yourdomain.com) is also assigned an IP-address.

A typical correct zone file will look like this:

;       @(#)yourdomain.com.hosts
;
; Addresses and other hosts information
;
; Start Of Authority Resource Record
; increment Serial Number when data change occurs
;
@       IN      SOA     ns1.hostingcompany.com.
dnsmaster.relay.hostingcompany.com. (
          2007040301      ; Serial Number
          28800           ; Refresh every .. sec
          7200            ; Retry after .. sec
          604800          ; Values expire after .. sec
          86400 )         ; Minimum keep time TTL .. sec
;
; Define Subnets, NameServers, MailServers
;
;
          IN      NS      ns1.hostingcompany.com.
          IN      NS      ns2.hostingcompany.com.
          IN      MX      120 ns2.hostingcompany.com.
          IN      MX      100 relay.hostingcompany.com.
          IN      A       192.168.0.1
; Define the hosts in the zone
;
relay     IN      CNAME   relay.hostingcompany.com.
www       IN      A       192.168.0.1

In this example we have following important information:

  • 2 domain servers (ns1.hostingcompany.com and ns2.hostingcompany.com) which are in charge of directing any requests for the web site or e-mail to the correct server. Domain servers are identified by “NS” in the configuration.
  • 2 mail servers (relay.hostingcompany.com and ns2.hostingcompany.com). It’s important to have 2 mail servers (listed by priority, e.g. 100 and 120) in case that the main server is unreachable. When relay.hostingcompany.com becomes unavailable, the mail is automatically stored on ns2.hostingcompany.com and forwarded again when the main server is online again. Mail servers are identified by “MX” records.
  • 2 IP numbers — one for the real web host and another one for the whole domain. Usually it’s the same IP-number for both cases. This means that requests for http://www.yourdomain.com and http://yourdomain.com will both directed to the same server which can then serve the web site. IP-numbers are identified by “A” records.
  • a CNAME is an alias for another machine. In our example, we’ve included an alias for the mail server which means that relay.yourcompany.com is the same as relay.hostingcompany.com.

More information about DNS setup and configuration can be found at Men&Mice. A good tool to check the health of your DNS setup is called DNS Expert and is also published by Men&Mice.

One of my favorite DNS tools is the DNSReport available at http://www.dnsstuff.com

O’Reilly Media publishes a book called DNS & BIND which is the official reference for anything related to domain name setup.

Leave a Reply