Requiring "www" for your web site

From DreamHost
Jump to: navigation, search


When you fully host your domain, you have the option to add the ‘www’ subdomain in front of it, or leave it off entirely. For example:


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.

Below are instructions that show you how to set your domain to use 'www'.

Forcing the ‘www’ subdomain to be added

  1. Navigate to the (Panel > ‘Domains’ > ‘Manage Domains’) page.
  2. Click the Edit button to the right of your domain under the ‘Web Hosting’ column.
    01 Add a domain.png
  3. Select the radio button for ‘Add WWW’.
  4. Scroll down and click the blue Save changes button to save.

Within about 10 minutes, your site will redirect to the ‘www’ version of the URL.

Forcing the ‘www’ subdomain in an .htaccess file

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

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

If someone types in, the URL now change to

Additional information

  • 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 subdomains. Spiders may not blacklist for a "www" mirror, but better to play it safe by picking one and redirecting the other to it.

See also