Take the 2-minute tour ×

I've noticed that a lot of websites redirect you from the unqualified domain to the www. subdomain. Is that the best practice as far as webapps go?

But not everyone does it. For example, heroku.com redirects you to www.heroku.com, but stackoverflow.com does the opposite, redirecting you from www.stackoverflow.com to stackoverflow.com.

What's the best practice here, if there is one, and why?

share|improve this question
Welll, websites are www.. The same way that mail is (traditionally) handled by mail., FTP is on ftp.. The domain itself tends to go to the same as www. for conveniance. Some people deliberately DON'T put a website on example.com. Whether you do is up to you. –  Deanna Oct 10 '12 at 12:12
add comment

closed as off topic by Deanna, Kris, dgw, rene, skolima Oct 10 '12 at 12:46


3 Answers

up vote 3 down vote accepted

The web right now is leaning towards not using the 'www'. However, you should always make sure (right now anyway) that both www.domainname.com goes to the same place as domainname.com.

As for which you set as the main server name, and which is the alias, thats kind of up to you, or maybe even your target market.

share|improve this answer
add comment

You can get either to work and they both should be setup to function.

There is one difference in the DNS handling of them. A subdomain www can be re-routed with a CNAME record to another hostname, which many CDNs require (e.g. Akamai) so sites on Akamai could not use the raw top-level-domain as their final URL. A straight top-level-domain (e.g. example.com) is routed to an IP only (for A and AAAA records).

If you're just directing to your own server though without getting fancy about hostnames it doesn't make any difference, but if you're going to get into working with CDNs, it probably will make a difference.

share|improve this answer
add comment

My mom always puts "www" on the front of everything. So if I tell her "https colon slash slash secure dot example dot com", she'll likely just hit http://www.example.com/, or if I'm lucky, https://www.secure.example.com/. The world is mired in tradition. As SilicaGel said, you really need to support both.

Of course, from a technical standpoint, it matters not in the least ... except that the unqualified domain SHOULD also have some other services running on it, like SMTP (in case MX hosts can't be determined). Note that what SHOULD happen is often not what actually happens. Far too many people fail to follow standards.

share|improve this answer
add comment
