Is there any way to point the root domain to a CNAME? [duplicate]

Here is the problem: we host our website with an external provider that doesn't give us an IP address, rather, they give us a domain where we point our www CNAME record to. I assume they are using some type of virtual hosting that reads the header for the requested domain and displays that website.

Anyway, a lot of our users complain the website is down when it actually is not because they are typing example.com instead of www.example.com into their browsers.

Is there a way to make this work in our DNS?


CNAME'ing your root is generally a bad idea, as all of the other records on the root (SOA, NS, MX) tend to be pretty important.

Your provider should really be allowing you to point to an address instead of a name. I appreciate what they're trying to do, giving themselves more flexibility to mess with that DNS entry as needed, but in this case it's counterproductive.


OK, this was asked some time ago, and there is already an accepted answer...

CNAME'ing your root is generally a bad idea,

You must not use a CNAME for your root example.com domain.

users complain the website is down [..] because they are typing example.com instead of www.example.com

There is a simple solution:

  • Point example.com at the IP address (A Record) of a webserver,
  • which sends out an HTTP 301 redirect to your www.example.com address.

This redirect takes at most perhaps two hundred milliseconds, and most users never notice it.

You can do this yourself, by setting up a webserver and a few lines of PHP / ASP / .HTACCCES etc. Note, this doesn't have to be your main production webserver; any cheap shared webhost with a static IP address will do.

Alternatively, many DNS hosting providers have this as a free-of-charge service. This would be the simplest & most robust option; leave it to someone specialized in this to host this redirect. Different DNS hosts tend to call this functionality by different names, for example Gandi calls it "Web Forwarding".

Is there a way to make this work in our DNS?

You mean, purely in DNS without using a webserver? No, there is not.