Hosting & Deployment

DNS Records for Web Hosting and Email

Understand and safely manage A, AAAA, CNAME, MX, TXT, SPF, DKIM, and DMARC records during hosting changes.

DNS connects domain names to hosting services. A change intended to move a website can also interrupt email if MX, SPF, DKIM, or DMARC records are overwritten. Before editing a zone, export or record the current values and identify which provider operates authoritative DNS.

Understand the common record types

  • A maps a hostname to an IPv4 address; AAAA maps it to IPv6.
  • CNAME aliases one hostname to another, subject to DNS rules.
  • MX identifies mail exchangers and their priorities.
  • TXT carries values used for SPF, DKIM, DMARC, and domain verification.
  • NS identifies authoritative name servers.
  • CAA can restrict which certificate authorities may issue certificates.

The root domain and www may use different record types. Avoid creating a CNAME at a zone apex where the DNS provider does not support flattening.

Plan a website migration

Lower the relevant TTL well before a planned move, wait for the previous TTL to expire, and then update the web records. Keep mail records unchanged unless mail is also moving. Verify the new server's virtual host and TLS certificate before directing visitors to it.

Useful checks:

dig example.com A
dig www.example.com CNAME
dig example.com MX
dig example.com TXT

Query more than one resolver when investigating propagation. A cached answer does not mean every resolver has updated, and DNS propagation is not a single global event.

Email authentication matters

SPF identifies permitted sending hosts, DKIM publishes a public key used to verify message signatures, and DMARC tells receivers how to handle authentication failures and provides reporting. These records must reflect the actual mail provider. Do not publish multiple independent SPF records for the same hostname; combine authorized mechanisms into one valid record.

Troubleshooting safely

Check authoritative name servers first, then compare answers from recursive resolvers. A website may resolve correctly while mail fails because MX or related TXT records are missing. Document the zone before and after changes, and keep a rollback copy. For cPanel, ensure the zone's mail-routing setting matches the actual mail architecture.

Share this page Help other developers discover this resource.