Connecting Hosting to a Domain: The Rules Involved
Choosing a hosting provider is a separate decision from registering a domain, but the two meet in a small number of places, all governed by DNS rules. Getting those connection points right makes moving hosts painless; getting them wrong causes outages that look mysterious. This page covers the rules, not the choice of provider.
Connection point 1: Where DNS is hosted
Your domain's name servers, set at the registrar and published by the registry, decide who answers DNS queries for it. There are three common arrangements:
| Arrangement | What happens when you change host | What happens when you change registrar |
|---|---|---|
| DNS at the hosting provider | You must move DNS when you leave | Usually unaffected |
| DNS at the registrar | Unaffected | DNS may stop unless moved first |
| DNS at a separate provider | Unaffected | Unaffected |
A separate DNS provider decouples both moves, which is why many organisations prefer it.
Connection point 2: Records for the website
Hosts usually ask you to point the domain at them. For a subdomain such as www, a CNAME to the host's name is fine. For the bare domain, the zone apex, a CNAME is not allowed under the DNS standards, because the apex must also hold SOA and NS records and a CNAME cannot coexist with other data (RFC 1034, RFC 2181). The options are address records (A and AAAA) to stable IPs, a provider's alias or flattening feature, a redirect from the apex to www, or HTTPS records (RFC 9460) for supporting clients.
Connection point 3: Records for email
If your host also offers email, or you use a separate mail provider, MX records point mail to it, and SPF, DKIM and DMARC records authenticate it. Keep one SPF record within ten DNS lookups (RFC 7208), and split long DKIM keys into strings of 255 characters or fewer.
Connection point 4: Certificates
Hosts usually issue certificates for your domain automatically, proving control through DNS or HTTP. If you publish a CAA record (RFC 8659), it must list the certificate authority your host uses, or renewals will fail.
Moving to a new host
- Lower the TTLs on records you will change, at least one TTL period in advance.
- Set up the site and certificates at the new host.
- Change the records, or the name servers if DNS moves with the host.
- Test from several networks.
- Restore TTLs.
- Keep the old host running until traffic has fully moved.
Changing registrar without disturbing hosting
If DNS is at the registrar, move it to a separate provider first. Then transfer the registration. A registrar transfer of a gTLD name should not change DNS when DNS is hosted elsewhere.
What to record
For each domain: where DNS is hosted, which records point at which host, which mail provider is used, and whether CAA is set. Keep it in your domain inventory.
This guide is general technical information. It recommends no hosting or DNS provider.