Publish with a domain, DNS and HTTPS
How do I publish a client website on a custom domain with DNS and HTTPS?
Deploy from a git repository, use preview deploys for review, point the domain with the right DNS records, confirm HTTPS, and keep a rollback and backups ready.
What you will be able to do
Deploy from git with previews for client review, point a domain at the site, confirm HTTPS, and keep a rollback and backups ready.
Before you start
- A site pushed to a private git remote, as in Build with an AI coding assistant.
- An account on a host that deploys from git. A free static tier suits most brochure sites.
- Access to the domain's registrar or DNS provider, ideally an account the client owns with you added as a user.
Why this matters
A DNS typo can take the client's email offline, and a broken deploy with no rollback means debugging live. With git, every commit can become a preview, the live site is one of them promoted, and you can put the previous one back.
For DNS, one rule: change only what you need, and record what was there first.
- 1BuildProduction output
- 2RepositoryEvery change versioned
- 3DeployPreview, then production
- 4DNSPoint the domain
- 5HTTPSCertificate issued
- 6VerifyClick through the live site
- 7RollbackKnow how to go back
Step by step
Tick each step as you do it. Your ticks are saved in this browser.
Connect the repository to your host
Create a site from your repository. Set the production branch (usually
main) and the output folder. Add environment variables in the host's settings, never in the code.Turn on preview deploys
Most hosts give every branch a preview URL to share with the client. Confirm previews are blocked from search indexing. When the client approves, merge into
main.git checkout -b homepage-review git add . git commit -m "Homepage ready for client review" git push -u origin homepage-reviewUnderstand the DNS records you will touch
- A and AAAA records: point a name, such as the bare domain, to an IPv4 or IPv6 address.
- CNAME record: points a name, such as
www, to a hostname your host gives you. - MX records: route the domain's email. Do not touch them for a website launch.
- TXT records: verification and email authentication. Leave existing ones alone. Add exactly what your host's documentation says.
Take a screenshot of the current DNS before changing anything
Save every existing record in the project folder. If email breaks, this fixes it in minutes.
Lower the TTL a day ahead if you can
TTL is how long other systems cache a record. A low TTL makes the switch and any rollback spread faster.
Add the domain on the host, then the records at the DNS provider
Add both the bare domain and
wwwon the host, choose one as the main address and redirect the other to it. Then add the records. Changes can take a while to spread, so launch on a quiet weekday morning.Confirm HTTPS and redirects
Most hosts issue a free certificate once DNS points correctly. Then test
http://andhttps://, with and withoutwww, in a private window. All four should end at one HTTPS address without warnings. Turn on forced HTTPS.Verify the live site, not just the dashboard
Open the live domain on your phone on mobile data. Submit the form. Email the client's main address to confirm their email still arrives.
Know your rollback before you need it
Find the host's option to redeploy a previous deployment and try it once on a quiet day. If something breaks, roll back first and debug second, or revert the bad commit:
git log --oneline # find the bad commit git revert 9e03c55 # create a commit that undoes it git push # host deploys the fixed versionSet up backups you control
Git backs up the code. Back up the rest: CMS content, stored form submissions, uploaded media and the DNS screenshot. Test a restore once.
Example
A launch log for the fictional Austin dental clinic, with made up values.
LAUNCH LOG: austinfamilydental.example
Day before
* Saved DNS screenshot
* Existing records: A (old site), MX x2 (email), TXT (email auth)
* Lowered TTL on the old A record
Launch morning
* Merged homepage-review into main, production deployed (commit 2ad81f0)
* Main address: https://www.austinfamilydental.example
* Replaced old A record with the host's value for the bare domain
* Added CNAME www -> the hostname from the host's dashboard
* Did not touch MX or TXT records
Checks
* http, https, www, bare: all end at https://www.austinfamilydental.example
* Booking form submitted from phone on mobile data: front desk received it
* Test email to the owner's address arrived: email unaffected
Rollback plan
* Host dashboard: Deployments > previous > Promote to production
* Or: git revert <commit> && git push
Give this log to the client too.
Common mistakes
- Deleting MX records while "cleaning up" DNS. The client's email stops arriving.
- Using your own registrar account for the client's domain. The client owns it and adds you as a user.
- Trusting "deployment finished." Verify the live domain on a phone on mobile data.
- No rollback rehearsal. Practise once on a calm day.
Try it yourself
Deploy your practice site from its repository to a static host with a free tier. Open a branch preview. If you own a spare domain, point it at the site and confirm HTTPS and redirects; if not, write out the DNS records you would add. Then push a deliberately bad commit and roll it back with both the host dashboard and git revert.
Time: about 45 minutes.
Deliverable: a launch log like the example, including the rollback test.
Check yourself
Resources
- Hosting comparison sheet compare hosts on their current terms
- Launch QA checklist the launch day checks
- Test before the client sees it testing on preview deploys
- Deploy, break and recover a site more practice with deploys and rollbacks
- Hosting fundamentals for agencies how hosting fits into your agency
Finished this lesson?
Mark it complete to track your progress through the course.
Last reviewed October 18, 2026. Prices, laws and tool terms change, so check current terms before you rely on any figure.
