Helping people with computers... one answer at a time.

There's a minor speed win that busy web sites striving to be as fast as possible might take advantage of that's a little cleaner if you start with www.

In a previous answer you mention that while is the standard way you refer to your site, "knowing now what you didn't know then" you might choose - why is that?

Naturally the question above is technically a constructed one, but as I shared my decisions and thought processes with others on how I arrived at "" as my standard and not "", this issue came up and I realized that I might have chosen differently had I known. I want to record what went into that thinking.

Warning: this is for website owners, and it gets fairly geeky.

If you don't care about the details then choosing to include "www" for your own site is a fine choice, just be consistent.

On the other hand, if you want to know why it might or might not matter, read on.

If I had to start Ask Leo! over again...

The short version is that there's a minor performance implication that would favor using "" over "" had I done so from day one.

"The issue comes down to cookies."

If you expect to have lots of traffic some day, "" might be the way to go, as well as placing static resources like images, css files and javascript files on another subdomain like "".

If you don't expect lots of traffic, then it doesn't matter. Pick with or without www and stick with it.

The issue comes down to cookies.

How cookies work, simplified

A cookie is just some data that a website instructs your browser to save for it. The next time you visit that same web site the cookie is sent along with each request for a resource from that site.

For example, when you visit one or more cookies may be placed on your machine and associated with "".

When you then request another resource from all the cookies that are associated with "" are sent with your request.

That's, fundamentally, how cookies work. They're just a way for a web site to save some data on your computer that's saved for the next time you visit that site.

Cookies are sent with everything

Cookies are sent with each request your browser makes no mater what you're requesting as long as the domains match.

Let's say I've visited, and cookies were placed on my machine.

Let's also say that the next page I visit on has two pictures on it.

  • The browser requests the page, and with that request sends the cookies that left from the previous visit with the request.

  • The browser requests the first picture, and with that request once again sends the cookies.

  • The browser requests the second picture, and with that request sends the cookies yet again.

In most cases cookies are kinda pointless for things like images. (Typically this applies to style sheets, videos, javascript files and perhaps others, but I'll use images as the example.)

And yet we sent up cookies twice for images when we didn't need to. That's additional data sent with each request that we didn't need to send, and additional time spent transmitting that data that we didn't need to spend.

There's a small speed improvement to be had here.

Solution number one

The most common solution to this problem is to simply move the images to a different domain.

Remember, cookies are sent for each request made on domain which previously left cookies. If the pages come from one domain, say "", and the images are all stored on a different domain, "", the cookies saved for won't get sent with the requests for images from

Seems fairly simple, and in theory it really is.

Unfortunately, there's a catch.

Why solution number one didn't work for me

My initial approach was to move all of the pictures on Ask Leo! to a different domain - - rather than

Different domain, right?

Kind of, but when it comes to cookies not different enough.

Since is a subdomain of the cookies are sent anyway. It's a different domain, but apparently the rules that govern how cookies work say that they should be sent in this case.

So even though the cookies were saved for the domain "", they were also sent with requests for images off of "". No speed improvement there.

Solution number 2: what I could have done from the start

Had I standardized on "" instead of "" as my default domain name to be used in all references then simply adding "" would have solved the problem.

If my pages had all been "" then all the cookies would be associated with that domain. "" is not a subdomain of "" and is, in fact, a completely different domain than "".

Even when it comes to cookies.

Cookies saved for "" would not have been sent along with requests for images from "".

Solution number 3: what I do today

I ended up moving all my images to a completely different domain - Nothing coming from ever leaves a cookie, and thus all the requests to and responses from are cookie-free.

Pages are fetched from "" and may leave and include cookies.

Images come from "" and are cookie-free.

Why I didn't change to www

You might be asking yourself why I didn't change from "" to "".

Mostly because I'm scared.

All of the search engine engines know my site as "". If I suddenly change to "", (which can certainly be done with no visitor impact), all of a sudden the site that the search engines know and (hopefully) love - - will have disappeared. The new site - - could instantly replace it, or it could take months to once again work its way into the search engine's loving embrace.

I can't afford the risk.

Does any of this matter?

For most websites, probably not. The amount of data we're talking about here is pretty small, especially compared to the massive size of so many sites pages.

If your traffic is light and expected to remain so, if you don't rely on search engine results for visitors to find you, or if your site uses no cookies at all, then this doesn't matter.

On the other hand, if you're trying to improve the speed at which your pages are displayed to users (which may be one of the many criteria used in search engine results ranking), and you do use cookies (if you have advertising, analytics, a newsletter signup form or any of a number of other things you almost certainly do), then this is a decision that you might want to consider when you initially set up the domain.

Place static files that need no cookies on a different domain than your site's domain. If your site uses "www." for all references then the different domain can simply be a separate subdomain, otherwise it'll need to be a completely different domain.

Article C4719 - January 21, 2011 « »

Share this article with your friends:

Share this article on Facebook Tweet this article Email a link to this article
Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

Comments on this entry are closed.

If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.

If you don't find your answer, head out to to ask your question.