I know it is good practice to keep your website entirely 'http://www' or http://, and i'm also aware the www is just a subdomain.
The main question I have is Which one of these would be the best choice? I'm configuring an htaccess for one of my servers right now, and can't decide to redirect all traffic away or toward the www subdomain. (I know how to do that by the way.)
This is simply a best practice question. I see big guys like Google and Amazon both forward to the www subdomain, but to me it sounds unnecessary - I don't want to miss anything.
Thanks!
The most common subdomain is www, which stands for World Wide Web. This subdomain contains a website's homepage and its most important pages. The www subdomain is so widely used that most domain registrars include it with domain name purchases.
Generally, the www prefix is not used when using subdomains. If you want to use the prefix with your subdomain, you can make a vhost file and add this behavior as part of your domain configuration. See below for more information on how to do this.
Better on-site experience Using a subdomain means you can provide a different user experience to your main website. Your subdomain is usually an expansion of your main website, when you want to explore a certain topic further but don't want this information on your main website.
Having an unnecessary subdomain spreads your SEO efforts across two sites instead of focusing on one. This means it could take double the links and content to get the same results if you simply focused on one domain. The consequences can be even worse if you have a blog on a subdomain.
Funny, I spent way too much time researching this for one of my companies websites last year. The conclusion I came to is that it doesn't matter so long as you redirect one to the other (users can find you at either version). For the last 10 years I have always used the www subdomain. Starting last year all my new projects are without it since it is unnecessary--may as well save the 4 characters.
My vote clearly goes for No WWW. Besides the fact that those four bytes (www.) are passed back and forth with each request/answer (every byte counts, right?). My clients are happy with this!
When one asks about printing on their business card or letterhead: "Will people know it is an Internet address, if it does not start with www?" I tell them to go ahead and print the www, just leave off the first dot!
On Printed Paper, I have seen my clients write all of these. However, most clients now prefer the first format to imitate CNN.COM:
Then if people use the dot, or not, it ends up at the right address (without all those extra bytes!)
Clearly, more people are following CNN.COM and moving away from www for most sites.
The easy solution I use from No WWW, Better SEO is to start each .htaccess with the following:
RewriteEngine On
RewriteBase /
# FROM www. --TO-- NO www.
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
This is just a cut and paste no-brainer. It is the first thing on each .htaccess I have on hundreds of sites and domains.
EDIT 2014/04/22
Reason to use a Subdomain: Cookies
There is one consideration for using a subdomain (like www, but not always www) and that is cookies.
If you assign a cookie for a domain it may be available to all subdomains (at least if not done very carefully!).
For example:
Whereas:
A better plan would be to have everything on a logical subdomain and direct the bare domain to one of them...
For example:
You would remove all www. from domains like www.usa.example.com and redirect example.com to earth.example.com (or web.example.com, or main.example.com or w.example.com!).
This way each subdomain could share the cookies of example.com and could have there own cookies too!
Of course, most websites do not use multiple subdomains, and therefore have no conflicts with cookies, and no reason at all to use the www.
EDIT 2017/12/12 - Static Content
Reason to NOT use a Subdomain: Static Content
One thing I didn't mention was Cookieless Static Content. Like many big sites, I use a separate domain for this.
Cookied Website Domain
Cookieless Static Content.
If you have many sites, you can set up one for Static Content.
Cookied Sites:
Domain for Cookieless Static Content.
Reason to NOT use a Subdomain: Green Website
Another reason to NOT use the www. is the "green" reason or the carbon footprint. With all things being equal... - www.example.com has a bigger carbon footprint than - w.example.com which is still bigger than - example.com
If one cares about their carbon footprint, or if a website claims to be "green", then they should not employ the "www." in their website address as these four characters would add to their carbon footprint in transmitting their domain name (howbeit a very small amount!).
Let a website prove they are really green by getting rid of the "www." in their domain!
Reason to NOT use a Subdomain: Psychological
Another reason to NOT use the "www." is the "psychological" aspects of writing code. Most programmers think in terms of the bare website. For example, I am working on SEO for a website called AngBarato.Com (it means "the cheap dot com" in Filipino. and is a buy and sell site). About half the links are to www.angbarato.com pages, and a half to angbarato.com pages. It was the coder's intention to use "www.", yet half the time he wrote the domain without the "www."
I convinced him these errors were very hard to find and deal with. For example, using the text editor Geany, we did a search for angbarato.com. Of course, all links appeared (some with and some without the "www."). On the other hand, doing a replace "www." for "" fixed all the links (and SEO) immediately!
Looking for "www.", and removing it, is a lot easier to debug than to look for where "www." does not exist, and quickly adding "www." to each missing link! Even worse if there are subdomains like www.usa.angbarato.com.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With