Requiring "www" for your web site

From DreamHost
Jump to: navigation, search

While some people prefer to not use "www" in their web site URL, some prefer that it always be there. Either way, it can sometimes be useful to have a single canonical name by which your site can be accessed.

Requiring "www" when a domain is hosted at DreamHost

It's easy..

  1. go to the "Domains > Web" area of the web panel
  2. click "Edit" for the domain you'd like
  3. select the option that says Always add "www." when somebody goes to
  4. click submit!

The change should take effect within 15 minutes.

Redirecting via mod_rewrite when not hosted at DreamHost

To force the use of "www" when viewers are reading your site, you can use the following mod_rewrite rule in your .htaccess file:

 RewriteEngine On
 RewriteCond %{HTTP_HOST}  !^www\.example\.net$       [NC]
 RewriteRule ^(.*)$1  [L,R]

This will ensure that anyone just typing your domain name in their browser ends up with the full name instead.

Reasons for Requiring WWW

Many domains offer a variety of services across many different hosts. These hosts are usually referenced using the server's fully-qualified domain name (FQDN). This name takes the form of host.domain. So in the FQDN, you can see that the host "foo" is part of the "" domain.

By convention, the web server hosting the main site for a domain can be referenced by using the hostname "www" (which is itself usually an alias, or CNAME record, to the servers actual FQDN). If you want to see the main site for, a good bet would be to try going to Other services are generally offered using the same naming convention. Our example domain's mail server might be, while their FTP server might be

Configuring your web server to also answer to just "" is often done as a convenience for users or as a way to shorten your URL. There is no requirement that this shortcut work and, while most domains do utilize this, many do not.


  • While most domains configure their main web server to answer to both forms, most do not bother with this type of redirection from one to the other. Ultimately, as long as the content served is the same, it doesn't usually matter what name is used to get to a given site.
  • One consideration when deciding whether to redirect "" to "" (or vice-versa) is that of Search Engine Optimization (SEO). Many search engines blacklist sites that "mirror" their site (have the same content at multiple URLs) under different domains and/or sub-domains. Spiders may not blacklist for a "www" mirror, but better to play it safe by picking one and redirecting the other to it.
  • There was a small movement at one time to get people to use "web" instead of "www" in their site names, thinking that it makes just as much sense and it's easier to say "" instead of "www..."

Related Articles