---
name: set-up-custom-domain-and-dns
description: Connects a custom domain to a hosted site - add the domain on the host, create the right A, CNAME or nameserver records at the registrar, choose www or apex, wait for HTTPS, redirect the other version, and keep email records intact. Use when the user bought a domain on Namecheap, GoDaddy or Cloudflare and wants their site on it, or DNS is not working.
license: CC-BY-4.0
metadata:
  category: deployment
  tags: "dns,hosting,security"
  author: johnny-bravo
  version: "1.0"
  updated: "2026-11-02"
  status: published
  aliases: "custom domain, dns records, point domain to vercel"
---

# Set up a custom domain and DNS

Your site runs on the host; your domain lives at the registrar. DNS records join the two.

## When to use
- You bought a domain and want your site on it.
- The domain shows an error, the wrong site or "not secure".
- You are moving hosts and need to switch the domain safely.

## When not to use
- You need the full pre-launch list. Use launch-website-checklist, then come back here for the domain step.

## Steps
1. Add the domain in your host's dashboard (Vercel, Netlify, Cloudflare Pages and so on). It will show the records it wants.
2. Pick the main version: `www.example.com` or `example.com` (apex). Both work; pick one.
3. At your registrar, add what the host asked for: usually a `CNAME` for `www` and an `A` (or `ALIAS`/`ANAME`) record for the apex. Or switch nameservers to the host if it offers that.
4. Before changing anything, screenshot the existing records, especially `MX`, `TXT` (SPF, DKIM, DMARC) and verification records.
5. Remove old `A` or `CNAME` records for the same names that point elsewhere.
6. Wait for DNS to update (minutes to a few hours). Check with `dig example.com +short` or an online DNS checker.
7. Wait for the host to issue HTTPS, then open the site with `https://`.
8. Redirect the other version (apex to www, or the reverse) in the host settings.
9. Update your site URL in app settings, auth providers, Stripe and analytics.

## Gotchas
- Switching nameservers wipes records the new provider does not copy, including email. Recreate `MX` and `TXT` records first.
- Cloudflare's orange-cloud proxy can conflict with a host's own HTTPS. Use DNS-only (grey cloud) unless the host says otherwise.
- Lower the TTL a day before a move so changes spread faster.
- Turn on registrar lock and two-factor login; a hijacked domain is hard to get back.

## Portability
Works with any registrar (Namecheap, GoDaddy, Porkbun, Cloudflare) and any host. Record names differ slightly; if you use a different host instead, follow the records its dashboard shows.

## Example prompt
"I bought mysite.com on Namecheap. Connect it to my Vercel project with www as the main version and keep my Google Workspace email working."

## Done when
- The site loads on the main domain over HTTPS.
- The other version redirects to it.
- Email and verification records still resolve.

---
House original by TheSkillVault (CC-BY-4.0).
