---
name: connect-a-custom-domain
description: "Point your .com at your host and your images subdomain at your CDN, both on https."
---

# Connect a custom domain

Purpose:: The project serves on its own .com: site on the host, images on the CDN, both https.

Rules::
- Domain = <name>.com; the owner buys it, the agent never pays
- DNS through the registrar's API; keys from your env file, never printed
- www redirects to the bare domain

Inventory::
- Registrar API (DNS records), host API (domains), CDN API (hostnames, certificates)
- Your env file with the keys

Steps::
1. If https://<domain> already serves this site, go to 5
2. Add <domain> and www (redirect) to the host project; read the A and CNAME values it asks for
3. Set DNS at the registrar: @ A, www CNAME, images CNAME to the CDN
4. CDN: add images.<domain>, load a free certificate, force SSL; repoint image URLs
5. Set the site URL to https://<domain>; add the domain to your login provider's redirect URIs
6. Reply in one line: https://<domain> live

Metrics::
- https://<domain> serves the project; www redirects
- Canonicals and the sitemap use the domain

Source:: https://isklls.com/skills/connect-a-custom-domain (iSklls, free skill library)
