Removing the "www" from your domain

From DreamHost
Jump to: navigation, search

Removing "www" when a domain is hosted at DreamHost

It's easy..

  • just go to the "Domains > Manage" area of the web panel
  • click "Edit" for the domain you'd like, column Web Hosting
  • select the option that says Always remove "www." when somebody goes to http://www.mydomain.com/
  • click submit! The change should take effect within 15 minutes.

Removing "www" option breaks Wordpress

If you create a wordpress page without this option turned on (as done above) and then turn this option on, your wordpress website disappears and the server gives a "Error 310 (net::ERR_TOO_MANY_REDIRECTS)" error. Workaround: reverse the step above (ie choose "leave it alone" in Dreamhost, rather than remove www".) Unfortunately, it seems then to *add* www. to the url, which is annoying, ugly, etc. Seems like a bug.

Workaround 2: Go into phpMyAdmin, and update the wp_options table and set siteurl and home values to http://yourwebsite.com (without the www, and it should start redirecting properly)

Removing "www" when not at DreamHost

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 upload it to your root directory.

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

Reasons for removing "www"

To quote from www. is deprecated, the inspiration for this article:

"By default, all popular Web browsers assume the HTTP protocol. In doing so, the software prepends the "http://" onto the requested URL and automatically connect to the HTTP server on port 80. Why then do many servers require their websites to communicate through the www subdomain? Mail servers do not require you to send emails to recipient@mail.domain.com. Likewise, web servers should allow access to their pages though the main domain unless a particular subdomain is required. Succinctly, use of the www subdomain is redundant and time consuming to communicate. The internet, media, and society are all better off without it."

Related Articles