You can shave a few bytes off your URLs and make them friendlier by not requiring the www . at the beginning of your domain name . Have your system administrator set your DNS server to resolve yourdomain.com and www.yourdomain.com , like this:
ServerName www.yourdomain.com ServerAlias yourdomain.com
This allows users to type in yourdomain.com to get to www.yourdomain.com . If you are on a server with named-based virtual hosting, you also need to add a ServerAlias directive inside the appropriate VirtualHost , like this:
NameVirtualHost ip.of.yourdomain.com:80 <VirtualHost ip.of.yourdomain.com:80> ServerName www.yourdomain.com ServerAlias yourdomain.com [...] </VirtualHost>
The ServerAlias directive in Apache specifies alternate names for a host. Some system administrators also provide misspellings and other alternate domains, like this:
ServerAlias foo.com foo.net ww.foo.com wwww.foo.com
You also can use a wildcard to match anything before the dot like this:
ServerAlias foo.com *.foo.com
It is important to provide an IP address for your domain; otherwise , Apache will be forced to perform a reverse DNS lookup.
You always need the DNS configuration; otherwise, the client won't find the server. The web configuration is needed only if you use name-based virtual hosting on the IP. Some high-profile sites still require the www . to access their sites. Three examples at press time are gannett.com, morningstar .com, and wendys.com. Requiring users to type in the www . to get to your site is like throwing traffic away.