Add or remove www from a domain


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


While some people prefer to not use "www" in their website 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. This article details how to do both.

This article does not apply to domains hosted on DreamPress. For DreamPress sites, you would need to update your .htaccess file to force a redirect.

Adding or removing "www" in the panel

This option creates a 301 redirect.

  1. Navigate to the Hosted Domains page.
  2. Click the Edit button to the right of your domain under the Web Hosting column.
    The 'Hosted Domain' page opens:
  3. Select one of the three options next to ‘Do you want the www in your URL?’:
    • Leave it alone: Both and will work.
    • Add WWW: Forces all requests to add www (i.e., all requests to go to
    • Remove WWW: Forces all requests to remove www (i.e., all requests to go to
  4. Scroll down and click the Change settings button to save.

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

Adding or removing "www" using an .htaccess file

If you do not want to use the panel option, you can still add or remove 'www' using an .htaccess file.

This involves creating and editing this file on your web server. View the following articles for further instructions:

Removing "www" through an .htaccess file

To automatically remove the www from the beginning of your domain, add the following mod_rewrite rule to your .htaccess file. If you don't have that file, create it in a text editor and then upload it to your root directory:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

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 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

When adding or removing "www" breaks WordPress

WordPress is unique in that it requires the URL to either force www or remove www from the domain name. If your database is forcing www but your panel is forcing it’s removal (or vice versa), you’ll see a redirect loop error such as this:

There are two solutions to resolve this.


Set the option above to Leave it alone.

Option #2

Make sure the option in your DreamHost panel matches what you selected within the WordPress configuration. View the Change WordPress Site URL article for instructions on how to update all URLs in your WordPress site.

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

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?