7

I came across a site that doesn't work when I type in the address with the "www." prefix. The following is an example: if you click on this link, it won't take you to any site, but rather display an error message. By simply doing away with the "www." prefix, as in here, the site loads up just fine. I can see why a site wouldn't load when the prefix is missing, but I can't think of any reason for a site not to work with it, rather than without it.

the_midget_17
  • 807
  • 2
  • 11
  • 27
  • 4
    http://blog.superuser.com/2011/12/15/wwwhats-in-a-name/ not exactly the same, but it covers your question. In short, there's no reason www should work unless a explicit subdomain is set up as such. – Journeyman Geek Jul 26 '12 at 03:03
  • you may be redirected to an unexpected site if you're in China, because some internet SPs hijacked DNS. – LiuYan 刘研 Jul 26 '12 at 03:49

3 Answers3

22

Your question is based on a somewhat false premise. There is no special reason example.com and www.example.com should go to the same site or both be valid other than that this is what people expect. As far as computers are concerned, they are two completely different names that could go to completely different places. People are free to set them up to go to the same place, different places, or make one work and the other not however they please.

There is simply a general agreement that the host name www will be used for the web site for a domain. But there is no technical reason anybody must follow this agreement.

You question is based on the false premise that example.com and www.example.com are somehow the "same site", one with a prefix and one without. In fact, they are two completely different potential site names that both happen to be under the control of whoever owns or manages example.com.

David Schwartz
  • 61,528
  • 7
  • 100
  • 149
  • Interesting indeed. Thanks for explaining so neatly. – the_midget_17 Jul 26 '12 at 03:21
  • There is also no reason why `example.com` and `www.example.com` must be under the control of the same entity, just like there being no reason why `com` and `example.com` would need to be under the control of the same entity. There is no technical reason why one cannot delegate `www.example.com` from `example.com` in exactly the same way that `example.com` is delegated from `com`. – user Jul 26 '12 at 09:34
11

I found the problem. The administrator of that domain name hasn't set up an address (A or AAAA) record for www.

error@underground ~ $ host itmanagersjournal.com
itmanagersjournal.com has address 216.34.181.202
error@underground ~ $ host www.itmanagersjournal.com
Host www.itmanagersjournal.com not found: 3(NXDOMAIN)

Compare this to what nearly every other site does:

error@underground ~ $ host facebook.com
facebook.com has address 66.220.146.101
facebook.com has IPv6 address 2a03:2880:10:1f02:face:b00c:0:25
error@underground ~ $ host www.facebook.com
www.facebook.com has address 66.220.146.101
www.facebook.com has IPv6 address 2a03:2880:10:1f02:face:b00c:0:25

Unless this is your domain, there's very little you can do to fix it, except perhaps contact the site and advise them of their problem and hope someone there has enough clue to fix it.

Michael Hampton
  • 13,635
  • 4
  • 45
  • 76
  • So, is setting up an address record for www common practice in this area? I mean, why do all the other sites work with the prefix and just this one doesn't. – the_midget_17 Jul 26 '12 at 03:10
  • Every other site works because every other site _has_ an address record. – Michael Hampton Jul 26 '12 at 03:11
  • I see... so this is merely an example of sloppy work, right? – the_midget_17 Jul 26 '12 at 03:12
  • Precisely. I added an example of a normal DNS setup to the answer. – Michael Hampton Jul 26 '12 at 03:13
  • @the.midget, Instead of creating an A* record, they can probably just configure their web server to use rewrite-rules to direct requests to `www.…` to `…`. Either way, if they only have a web-server (i.e., no ftp, gopher, svn, mail, etc.), then there is no reason that they *have* to use a `www` prefix since that name is only ever used for serving web pages (hence `www` is redundant). – Synetech Jul 26 '12 at 03:43
  • 8
    It's not really a "problem"... – cutrightjm Jul 26 '12 at 03:55
  • http://serverfault.com/questions/145777/whats-the-point-in-having-www-in-a-url – Michael Hampton Jul 26 '12 at 04:25
  • @the.midget: A quick way to check the A records for a host.domain.tld is with `dig`. eg. `dig example.com` and `dig www.example.com`. – paradroid Jul 26 '12 at 05:12
  • 1
    @Synetech: No they can't. If there's no DNS record (whether A or CNAME or, for IPv6, AAAA) for `www.…`, then the browser can't send a request to it, and so can't receive any redirect in return either. – Ilmari Karonen Jul 26 '12 at 12:09
  • @IlmariKaronen, then how do hosts allow customers to create subdomains? Surely they don’t create a separate record for every possible subdomain. – Synetech Jul 26 '12 at 15:16
-1

I finally found the solution to making the WWW work.

You gotta locate the Forward URL (or Forwarding URL) feature in your host's settings for your domain. Do a search on the Help database to find it's location, or contact tech support they'll let you know where it is.

All you gotta do is enter "https://www.yourdomain.com" with the www in front of the domain (and use https, not http), and select the option "301 Permanent Redirect". You're done! This will direct all traffic and visitors from www.yourdomain.com to yourdomain.com.

Be sure however to add the Forwarding URL to the correct hosting service provider, for example, if you buy a domain from godaddy.com and you're using GroovePages.com to create your free website, you'll need to go to CloudFlare.com to add the Forwarding URL there by going to Page Rules, because GroovePages uses cloudflare.com as their hosting. When you signup to groovepages they also make you manually sign up to cloudflare.