image

Your Site Only Works with WWW? How and Why to Fix It.

Three steps to stop losing business that can never be recovered.

This happens too often with websites of companies large and small: If the visitor does not type “www” at the start of a domain, the site fails to load. Why does it matter? Because there’s no way to know how much traffic the site has lost, and no way to get it back.

I discovered this again yesterday at the website of the New York-based music label which currently has the number one song on the country music charts. A company that successful shouldn’t be making this mistake. (For an update on the company’s site, see author’s note at end of article.)

You won’t have this problem if you host your site at Emagine Engine—we’ll make sure of it. For everyone else, the steps below will help you get your site to load—whether or not the visitor types “www.”

First, Fix the Problem

When your domain will not load without the “www” sub-domain, the fix can involve both domain and server configurations.

Domain Configuration

If your domain is pointing to a nameserver located at your hosting company, you can ask the hosting company to make changes, or you can make the changes yourself (after reading this entire post). Reputable hosts provide domain tools inside the hosting control panel—just log in and find them in the “Domains” section.

Then again, you may be managing the domain records yourself, at your Domain Registrar (for example). Log into the domain control panel and examine the “A” and “CName” records.

Two words of caution: Be Careful. Changes do not propagate across the Internet immediately, and it’s possible to disable your domain without realizing it for several hours. Carefully read the documentation provided by your registrar. And when in doubt, place support tickets. You need to understand the changes before you make them.

The normal setting for domains is to have an A-record without the “www” prefix; this points directly to the IP address of the Web server.  There should also be a CNAME record for the domain with the “www” prefix; this points to the domain name without “www.”

If either of those is missing, you have found the problem. At this point, you should have enough information to fix the problem. However, the safest approach is to place a support ticket and ask the domain provider to confirm the change you are about to make.

Server Configuration

Once you have your domains configured, your Web server also needs to know about each version of the domain name.

At this point, type your domain without “www” into your browser and see if it loads your site. If it loads, you can skip to the next step. The Google Chrome browser has the advantage of not adding the “www” to the domain (unless you hold down the CTRL key while you press Enter), so it’s a good one to use for this test. In the Hacker News discussion of this article, Kevin Grant of MacTerm fame reported that other browsers add the “www,” although I have not tested for it myself.

If the site still does not load without the “www,” continue with this step.

Let’s say that you do not manage your own server. If you used the domain tool within the hosting control panel, the tool should have made the server configuration change for you already. But if not, ask your hosting provider to make sure the updates (detailed below) are made to the server.

If you run your own self-managed server, you need to get your hands dirty. This is true of a physical box on-site, a remote “dedicated server,” a “virtual-dedicated server,” or a virtual cloud-based server.  Below are the directives for the Apache server, which is what we support at Emagine Engine.

You must tell Apache about the domains in a configuration file called httpd-vhosts.conf. You will input the following, replacing “mydomain” with your domain name.

        <VirtualHost *>
        ServerName mydomain.com
        ServerAlias www.mydomain.com
        </VirtualHost>

It’s best to let the technicians do this, if you are not one yourself.

Second, Focus Your Traffic On One Domain

Once you can load your site using the non-www URL, add the final touch by redirecting all traffic to a single domain. When you focus on one version of your domain, it’s easier to build search engine authority for it. Over at Bing Webmaster Tools, Bing Webmaster Help offers a nice writeup on the importance of using redirects to avoid the pitfalls of duplicate content.

On the Apache server, this is done with the code shown below. If you have access to the httpd configuration file mentioned above, just add the code at the bottom of the VirtualHosts directive. Alternatively, this can also be added your .htaccess file, which is a text file located in your public website directory. (If you cannot see the .htaccess file on the server using FTP, check that your FTP client is set to display “dot files.” You can also edit it using the Web-based “File Browser” available from within your hosting control panel.)

Use the following code to redirect all traffic to the non-www version of your domain:

        RewriteEngine On
        RewriteCond %{http_host} !^yoursite\.com$ [NC]
        RewriteRule ^(.*) http://yoursite.com/$1 [L,R=301]


Or, use the following code to redirect all traffic to the www version of your domain:

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

Which version you use depends on whether you want http://www.mydomain.com, or simply http://mydomain.com, to be the domain for which you build search engine authority.

The good folks over at no-www.org argue that the “www” is deprecated, and provide the following Mod Rewrite code to redirect to the non-www version of your domain. This has the advantage of working with any domain you may have since it automatically senses the current domain.

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

I recommend the EasyModRewrite site for a more detailed discussion of how to force www (or no www) with Mod Rewrite.

But for now, let’s continue to the final step.

Third, Tell it to Google

You should now tell Google that you prefer a particular version of your domain to make certain that your site ranking does not get diluted between domains. You addressed this with the redirect in Step Two, but that’s a blanket approach that applies to all search engines. 

With very little effort, you can tell Google that you prefer a particular version of your domain. This is smart for any site, but if you happen to have a large amount of content indexed under both versions of your URL, then it’s particularly important. By explaining the change, it ensures that Google does not assume you have simply duplicated content across different domains (a favorite tactic of spammers).

To tell Google about the change, register for Google Webmaster Tools, confirm that you manage the domain, and specify your “Preferred Domain.” Google provides a nice tutorial on setting your preferred domain (www or non-www).

Conclusion

There you have it: How to make your website load with or without “www,” how to redirect all traffic to one version of the domain, and how to tell Google about it. Your site will be easier to find, and its search engine ranking will not be diluted across two versions of the same domain.

These changes are sensitive and things can go wrong. If you are not a technician, I suggest you reach out to us or to someone in your organization to make the changes. Also, these instructions are specific to Apache Web Server, which we support here at Emagine Engine. If you don’t use it, you should.

Author’s Note: The music label mentioned in this article has corrected the problem as of today (Dec 5, 2011), using some of the information from this article which we had provided directly to the Vice President of Music Publishing. The company has not yet followed the second step—focusing Search Engine Ranking on a single version of the domain—but at least they are no longer blindly losing traffic.

Photo Credit: Wikiversity Public Domain Photo by Oliver Kurmis.

Dec 01, 2011, Larchmont, NY.

About the Author

Phillip Honstein is the founder of Emagine Engine, a Web Consultancy dedicated to helping clients turn big ideas into influential ventures through Responsive Web Development. Emagine Engine combines the ingredients of Entrepreneurship, Web Development, Web Hosting, and Internet Marketing into products and services that are in touch with each phase of Venture Development. Emagine Engine is a privately held and funded business located in Larchmont, New York, United States.