‘www’ prefix to domain name

When we purchase a domain name (for e.g. say domain.com), we actually get the ownership of both www.domain.com and domain.com

Even though we can configure both the above web links to show the same page and get associated to same hosting, there are couple of problems that come up:

  1. Browser does not share the cookies among them. So if a user logs in on domain.com and then switches to www.domain.com, he will not see himself logged in.
  2. SEO treats them as different domains and credibility of your web site divides into two halves, one for each of them.

That is the reason, you see every other sites live with one of them and redirects the other one to the one they use. For e.g.

Meaning to say they are both keeping one instance of domain name to avoid above problems.
What is the best way to counter this?
Set up server alias or redirects:
For most of the web/cgi languages, here is the redirect tutorial: http://www.webconfs.com/how-to-redirect-a-webpage.php
I set up my domain name on Heroku using this tutorial: http://docs.heroku.com/custom-domains and had to set a cname for my www.domain.com and namespace entries for domain.com. It resulted in different resolutions of both the domain names.

sanchitg@businessonce-lm:~$ host traveltriangle.com
traveltriangle.com has address 75.101.145.87
traveltriangle.com has address 75.101.163.44
traveltriangle.com has address 174.129.212.2
traveltriangle.com mail is handled by 10 mail.active-dns.com.
sanchitg@businessonce-lm:~$ host www.traveltriangle.com
heroku.com has address 75.101.163.44
heroku.com has address 174.129.212.2
heroku.com has address 75.101.145.87
heroku.com mail is handled by 1 aspmx.l.google.com.
heroku.com mail is handled by 5 alt1.aspmx.l.google.com.
heroku.com mail is handled by 5 alt2.aspmx.l.google.com.
heroku.com mail is handled by 10 aspmx2.googlemail.com.
heroku.com mail is handled by 10 aspmx3.googlemail.com.
heroku.com mail is handled by 10 aspmx4.googlemail.com.
heroku.com mail is handled by 10 aspmx5.googlemail.com.

One thought on “‘www’ prefix to domain name

Comments