This question already has an answer here:

Good day,

I currently have an existing domain for a large company. We are using a service to manage our DNS.

We had an existing domain with many subdomains, with a legacy website.

Recently we wanted to update our website, we did so by developing it on AWS and getting it really good.

We now need to update the DNS configuration.

This existing configuration looks something like this

  • A mydomain.com [original ip]
  • MX mydomain.com [original link to mx setup for mail]
  • TXT mydomain.com [mx extensions for mail]

this setup points to office 365

now I needed to update this, so my first thought is add a CNAME record

CNAME mydomain.com [point it to ELB in aws]

this works and my site is now live.

BUT

the mail servers are now broken.

Then I tried removing the CNAME and adding

CNAME www.mydomain.com [point it to ELB in aws]

this works, both with the website and mail but is a bad experience for our users

what I want to do is not damage the original setup and still have

CNAME mydomain.com redirect to my new website

and not have our mail servers breaking.

Is there a way to do this? Its really painful for our users to have to type wwww.mydomain.com and most people won't do it and we are losing users.

how can I have my basedomain with a cname record and have it not override the other records? I know the short answer is it will, but I need a work around to achieve the business result I need, any thoughts?

This is my ideal setup

  • A mydomain.com [keep it as it was]
  • MX mydomain.com [keep it as it was]
  • CNAME mydomain.com [point it to new website]
  • TXT mydomain.com [keep it as it was]
  • CNAME www.mydomain.com [point it to new website]

marked as duplicate by Esa Jokinen, Andrew B domain-name-system Apr 20 at 22:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

No, it's not possible as CNAME can't co-exist with any other records (RFC 2181, 10.1; RFC 1912, 2.4), including your A, MX, TXT, the only exception being DNSSEC related records (RFC 4035, 2.5). Also, and even more importantly, it can't co-exist with NS, making it impossible to be used for the domain itself.

Add only the www.example.com. CNAME and arrange HTTP redirect on what ever the example.com. A points to.

  • RFC 1912 is Informational not a good source for citations. RFC 2181 is usually better for this purpose. – Andrew B Apr 20 at 18:55
  • 1
    That's fine, just remember that citing an Informational RFC is like citing an article from an IT magazine. – Andrew B Apr 20 at 19:06
  • Sure, although there's nothing wrong with citing such articles. Also noticed that this actually is a duplicate of your canonical question. – Esa Jokinen Apr 20 at 19:08

You cannot have your base domain with a CNAME together with other records.. but you dont necessarily need that:

While just a commercial service - not part of any official standard or available with a huge amount of DNS hoster (though available at some huge ones) - there exists a mechanism for precisely that use case.

Typically called something like ALIAS (e.g. Route53) or ANAME (e.g. DNS made easy, name.com, easydns) and configured by means similar to standard records, the DNS hoster offers to create/update standards-compliant A/AAAA records in your zone, which will then match your configured target domain.

An ANAME record is like a CNAME record, but at the root level.

  • 1
    "this feature is called ANAME by most providers" is an incorrect statement. ANAME is a custom "record" type implemented by DNS Made Easy. Other hosting companies implement similar synthetic record types. (ALIAS, ANAME, etc.) None of these are a part of an official DNS standard. You are correct that people are free to take their business where it is most convenient for their needs, but that is about it. – Andrew B Apr 20 at 18:59
  • 2
    This answer could be improved to be the most helpful answer here. Just state clearly that this is not in DNS standards, but a service. Also, add some similar alternatives, like Route53 alias records. – Esa Jokinen Apr 20 at 19:12
  • I stand corrected, ALIAS is totally the more common name because of Route53. – anx Apr 20 at 19:27
  • Only bad thing being that canonical name CNAME is often falsely called an alias, because it kind of acts like one. I've even seen misunderstandings that A is an abbrevation of alias. Wrong, wrong, wrong. – Esa Jokinen Apr 20 at 19:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.