Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do some websites require "www"? [closed]

When browsing through the internet for the last few years, I'm seeing more and more pages getting rid of the 'www' subdomain.

Are there any good reasons to use or not to use the 'www' subdomain?

like image 471
Xn0vv3r Avatar asked Jan 28 '09 06:01

Xn0vv3r


3 Answers

There are several reasons, here are some:

1) The person wanted it this way on purpose

People use DNS for many things, not only the web. They may need the main dns name for some other service that is more important to them.

2) Misconfigured dns servers

If someone does a lookup of www to your dns server, your DNS server would need to resolve it.

3) Misconfigured web servers

A web server can host many different web sites. It distinguishes which site you want via the Host header. You need to specify which host names you want to be used for your website.

4) Website optimization

It is better to not handle both, but to forward one with a moved permanently http status code. That way the 2 addresses won't compete for inbound link ranks.

5) Cookies

To avoid problems with cookies not being sent back by the browser. This can also be solved with the moved permanently http status code.

6) Client side browser caching

Web browsers may not cache an image if you make a request to www and another without. This can also be solved with the moved permanently http status code.

like image 63
Brian R. Bondy Avatar answered Oct 19 '22 11:10

Brian R. Bondy


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.

like image 22
jacobangel Avatar answered Oct 19 '22 12:10

jacobangel


Just after asking this question I came over the no-www page which says:

...Succinctly, use of the www subdomain is redundant and time consuming to communicate. The internet, media, and society are all better off without it.

like image 27
Xn0vv3r Avatar answered Oct 19 '22 11:10

Xn0vv3r