http://www.example.com points correctly to the IP address of the server where the site is hosted.
http://example.com (notice the lack of www) points to a different IP address.
The DNS records for the domain have no reference to this foreign IP address – what might be causing this?
Best Answer
As most of the replies have noted, you need an
A
record at the base of your domain-name pointing to the IP address of the web server.However I would not recommend that
www
be aCNAME
pointing at that base domain-name unless you understand exactly what you're doing.Although this might seem simplest from a management point of view (only one record to change if your site changes IP address) it can have side effects.
Don't forget that a
CNAME
makes the left-hand-side (the "owner name" of the CNAME) equivalent to the right-hand-side for all DNS resource record types, and not just forA
record queries.So, if your zone looks like this:
then a query for
www.example.com IN MX?
will return the same MX record as forexample.com
. Now if that's what you want, that's fine.However it'll also do the same for the other records (
SOA
,NS
,SPF
, etc) which is not usually desired.Hence the proper answer should be to just make
www
anA
record too, with the same value as the base name: