Requiring "www" for your web site

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..
 * just go to the "Domains > Web" area of the web panel
 * click "Edit" for the domain you'd like
 * select the option that says Always add "www." when somebody goes to http://www.mydomain.com/
 * 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 ^(.*)        http://www.example.net/$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. So in the FQDN, you can see that the host "foo" is part of the "example.net" 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 example.net, 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 "example.net" 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.

Related Articles

 * Removing the "www" from your domain