When should one use a ‘www’ subdomain?

There are a ton of good reasons to include it, the best of which is here:
Yahoo Performance Best Practices

Due to the dot rule with cookies, if you don’t have the ‘www.’ then you can’t set two-dot cookies or cross-subdomain cookies a la *.example.com. There are two pertinent impacts.

First it means that any user you’re giving cookies to will send those cookies back with requests that match the domain. So even if you have a subdomain, images.example.com, the example.com cookie will always be sent with requests to that domain. This creates overhead that wouldn’t exist if you had made www.example.com the authoritative name. Of course you can use a CDN, but that depends on your resources.

Also, you then don’t have the ability to set a cross-subdomain cookie. This seems evident, but this means allowing authenticated users to move between your subdomains is more of a technical challenge.

So ask yourself some questions. Do I set cookies? Do I care about potentially needless bandwidth expenditure? Will authenticated users be crossing subdomains? If you’re really concerned with inconveniencing the user, you can always configure your server to take care of the www/no www thing automatically.

See dropwww and yes-www.

Leave a Comment