Is the www subdomain good practice?
Asked Answered
D

4

6

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!

Donate answered 28/6, 2012 at 14:27 Comment(3)
The question on meta about why there's no www for stackoverflow.com might be of interest - it links off to other resources also.Vacuous
This question is probably better suited for the Webmasters stack exchange.Mori
...where this question is a duplicate.Andrade
E
7

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.

Extempore answered 28/6, 2012 at 14:35 Comment(3)
Should note: It's important to be consistent on this and refer to one as the canonical version. It can really screw up how Google indexes your website if you're inconsistent.Mori
Side note: there may be some consideration if your site is quite large and makes use of cookies since you may want some cookies sent for subdomains but not on the www subdomain or visa versaExtempore
I assumed it was just a matter of preference. Thanks for the confirmation!Donate
P
2

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:

  1. www example.com
  2. www: example.com
  3. web: example.com
  4. Internet: example.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:

  • example.com cookies would be available for
  • philippines.example.com

Whereas:

  • www.example.com cookies or
  • earth.example.com would not be available for
  • philippines.example.com

A better plan would be to have everything on a logical subdomain and direct the bare domain to one of them...

For example:

  • earth.example.com
  • canada.example.com
  • philippines.example.com
  • usa.example.com

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

  • example-1.com

Cookieless Static Content.

  • static-example.com -

If you have many sites, you can set up one for Static Content.

Cookied Sites:

  1. plant-only.org
  2. vekind.org
  3. fyuel.org
  4. tait.asia

Domain for Cookieless Static Content.

  • my-static-content.info
    1. plant-only.my-static-content.info - for plant-only.org
    2. vekind.my-static-content.info - for vekind.org
    3. fyuel.my-static-content.info - for fyuel.org
    4. tait.my-static-content.info - for tait.asia

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.

Prosper answered 16/10, 2012 at 5:26 Comment(1)
Static Content - One thing I didn't mention was Cookieless Static Content. Like many big sites, I use a separate domain for this. example-1.com - Cookied Website Domain static-example.com - Cookieless Static Content. If you have many sites, you can set up one for Static Content. Cookied Sites: plant-only.org vekind.org fyuel.org tait.asia my-static-content.info - Cookieless Static Content. plant-only.my-static-content.info vekind.my-static-content.info fyuel.my-static-content.info tait.my-static-content.infoProsper
G
1

Unless you plan on putting your site behind a cert, I recommend having both hosts be accessible.

Gruelling answered 28/6, 2012 at 14:36 Comment(2)
I plan on it, but one will simply do a 301 to the other - IE you go to www.example.com/index would 301 to example.com/index. It's good practice to keep everything the same for cookies etc.Donate
In that case, you as long as you're grabbing traffic from both and redirecting to one or the other, you'll be fine. I redirect to www, but it's purely preference and shouldn't have any negative implications.Gruelling
E
0

Bottom-line; It doesn't really matter, as long as both are still accessible.

I tend to remove the www. most of the time, since technically it is no longer necessary.

However for shorter domainnames adding the www. sometimes makes it look better visually. Kind of like interior design where you need to have a odd number of items. E.g www.xyzjk.com looks very symmetrical and there are 3 pairs of characters (odd). I guess that is why google uses www.google.com and not google.com.

The other thing is that in some CMSs or Forums urls have to start with either http:// or www. to be converted to a clickable hyperlink. So to possibly get some extra incoming links, you might want to prefer www.

Elizaelizabet answered 28/6, 2012 at 16:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.