-1

I'm trying to map somedomain.com to here.anotherdomain.com. I can do any sub domains of the original using a CNAME but the root domain ( somedomain.com ) needs an A record. This is currently set to the ip address of the server ( anotherdomain.com ).

My question is, do I add a CNAME record of somedomain.com to point to here.anotherdomain.com on the server DNS zones?

NAMESERVER RECORDS
A somedomain.com 123.123.123.123
CNAME www here.anotherdomain.com

SERVER RECORDS
CNAME somedomain.com here.anotherdomain.com

The nameservers are at codeigniter and the server is cPanel.

Thanks for any help

Joe

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
jhodgson4
  • 101
  • 1

3 Answers3

1

The DNS spec, RFC 1035, does not for the 'naked domain' (domain.com) to have CNAME's. More technically, it states that a CNAME must be alone, so you can't have both CNAME's and NS's (and other records required for a domain to work).

Cloudflare went ahead and tried to handle this on their end, by allowing a CNAME as the root record, whereafter they will resolve it and present an A record to the end-user. You can use Cloudflare for their DNS service only, if you so wish - so that's always an option.

Source: http://blog.cloudflare.com/introducing-cname-flattening-rfc-compliant-cnames-at-a-domains-root/

  • I do love cloudflare! Great resource thanks for sharing! – jhodgson4 Oct 07 '14 at 15:40
  • 1
    It should be noted that what Cloudflare is doing is *not* a CNAME record as defined by the DNS standards. [It's a custom behavior that borrows the name of the record.](http://serverfault.com/a/613830/152073) – Andrew B Oct 07 '14 at 18:25
1

Just put both somedomain.com and here.anotherdomain.com to the same ip address, create a vhost for here.anotherdomain.com and no vhost for your somedomain.com
or
put both in the same vhost enter somedomain.com and here.somedomain.com then make a rewright to your apache to your default domain here.anotherdomain.com.

Dimitrios
  • 119
  • 3
  • I think this is what I'm looking for. So am I write in thinking with the CNAMES in place, doing it this way will mask the domain? – jhodgson4 Oct 07 '14 at 15:41
  • @jhodgson4 No, you can't do it with a CNAME because it is a violation of standards. The best you can do (barring implementation specific behavior such as Cloudflare's) is to point the apex at a webserver that redirects them to the proper site. – Andrew B Oct 07 '14 at 18:29
0

I'm puzzled, because somedomain.com doesn't need a A record. See for example the records for fdn.fr and www.fdn.fr. If your DNS provder require a A record for somedomain.com, you should put a HTTP redirect or something like that behind.

Yes you should add a CNAME record. If you really want users to connect to here.anotherdomain.com you should consider redirection mechanism at higher protocol level (e.g. HTTP 301 redirect)

Manu H
  • 158
  • 6
  • 1
    You cannot CNAME the apex of a domain if the implementation is standards compliant. (ignoring Cloudflare, because what they do isn't a real CNAME) – Andrew B Oct 07 '14 at 18:27