I have a bit of a unique problem. for the domain (example.com) I want people to go to www.example.com however I'm also throwing GSLB into the mix. for GSLB the devices(one in each datacenter) need to be the nameserver for portion of the domain that they are going to answer for(www.example.com) so I know I can make the NS record of www.example.com just fine and have it point to each GSLB device. However that only helps for www.example.com NOT example.com. I don't want to make my root NS of example.com my GSLB as my enterprise managed DNS provider does an excellent job of all DNS stuff. any ideas?
You'll need to set up a web server at
example.com
and do redirects. I would suggest that the redirects are 301 (permanent) and not 302 (temporary) as you want any links toexample.com
to count as links towww.example.com
from an SEO point of view. There are services out there that can handle the redirects for you, or you can roll your own.A CNAME-based solution is suboptimal because 1) technically you can't have CNAMEs when you have other records, and 2) you'd be surfacing identical content at two different addresses and search engines don't like that.
A common approach to overcome this limitation in DNS is to provide a HTTP 302 redirect from example.com to www.example.com.
Here are the restrictions based on the RFCs:
CNAMEs must have no other resource records of other types (MX, A etc) as specified by RFC 1034 section 3.6.2 and RFC 1912 section 2.4. The exception is when DNSSEC is being used, in which case there can be a DNSSEC related recrd such as RRSIG, NSEC, etc. (RFC 2181 section 10.1)
CNAME records that point to other CNAME records should be avoided. In particular, it is possible to create infinite loops with CNAME records, and other error conditions. RFC 1034 section 5.2.2.
Other DNS record types, such as NS, MX, PTR, SRV, etc that point to other names should never point to a CNAME. RFC 1034 section 3.6.2, RFC 1912a, section 2.1.
Use redirection of a web server and in dns define CNAME www to example.com.
A CNAME record should be able to redirect requests for example.com to www.example.com.