The www Saga – Should Your Domain Be Naked?

Long ago, near the dawn of the UNIX epoch, servers were generally single-task in nature.  To have one server machine fill multiple roles was unusual.  This was because CPU cycles, RAM, and disk space were hard to find and what resources a machine did have needed to be available for the task at hand.

This situation gave rise to the Internet-naming scheme of putting www before a website address.  The reason for this was that there was literally a machine named www that served the website for that domain.  In today’s era of virtualization, this is no longer the case.  A single server can host thousands of websites and the www prefix is slowly falling out of favor.

There is a debate among webmasters about using the www prefix before your domain name.  To not use it is referred to as a naked domain, that is, typing yourdomain.com into the browser to reach your site without the www before it.  In the past websites have generally accepted both but redirected to the www version.  Now it is increasingly common to see sites use the non-www variety and redirect to the reverse.

Google understands the difference and will not penalize you for duplicate content if you serve from both versions. It really doesn’t matter what you choose but whatever you do it is strongly advised to be consistent.  If you want to use www in front of your domain, then always use it.  If you don’t want to, don’t link to it with www in front of the domain.  Here are some ways to accomplish that:

WordPress

If you use WordPress, this is a fairly simple situation to solve.  In the General page under Settings, simply specify the version you’d like to use. In this case for our site we use the www version because our site has been around since 1997 and we have a lot of links to that variation.  Specifying this here will redirect non-www requests to the proper URL.

general-settings-www.png

Other Linux-based Sites (Static HTML, PHP, etc.)

If you’re not using WordPress, you can use an .htaccess rule to address this situation.  For example, this rule:

RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

This will redirect all traffic to the www version of your site and respect the use of SSL.  You can remove the www. from the last line above to do the opposite.  Do not use this solution if you are using WordPress – the two rules can conflict or, at best, unnecessarily duplicate each other.

Microsoft IIS

For .NET websites, you can use the web.config solution here to handle www redirection.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s