Deploying Static Sites to Netlify and GitHub Pages with Custom Domains
You've built a stellar static site, pushed it to GitHub, and hooked it up to a hosting provider. But default subdomains like your-app.netlify.app or username.github.io/repo don't look professional. Connecting a custom domain—like blog.bentaherghassen.com—transforms your personal project into a polished, production-ready brand.
If you've already added your domain registrar settings and see that it's auto-verified, congratulations! You've cleared the first major hurdle. Now, what do you need to do next to make your site live?
You Added Your Domain and It's Auto-Verified: Next Steps
Auto-verification usually means your DNS provider (like Cloudflare, Namecheap, or Google Domains) confirmed ownership via TXT records, or your hosting provider detected existing DNS pathways. However, verification is only proof of ownership; you still need to point the traffic to your host and secure your connection.
Step 1: Configure Your DNS Records (A and CNAME Records)
To direct traffic from blog.bentaherghassen.com to your hosting provider, you must log into your DNS provider and configure the records:
- For Netlify: Add a
CNAMErecord where the name/host isblogand the value points to your Netlify site URL (e.g.,your-site-name.netlify.app). - For GitHub Pages: If you are mapping a subdomain like
blog.bentaherghassen.com, add aCNAMErecord with the host nameblogpointing to your GitHub Pages address (username.github.io).
Step 2: Bind the Domain in Your Hosting Dashboard
Once DNS records are set, your host needs to know which domain maps to which project:
- Netlify: Go to Site configuration > Domain management > Custom domains, click "Add domain", and type in
blog.bentaherghassen.com. - GitHub Pages: Go to your repository's Settings > Pages, and under "Custom domain", enter
blog.bentaherghassen.comand save. GitHub will automatically create aCNAMEfile in your repository branch.
Step 3: Enable HTTPS / SSL Certificate
Never skip security. Since you are using a custom domain, you need an SSL certificate so visitors don't see a "Not Secure" browser warning.
- Netlify: Scroll down to the SSL/TLS certificate section in domain management and click **Verify DNS / Provision Certificate** to let Let's Encrypt issue a free SSL certificate.
- GitHub Pages: Check the box that says **Enforce HTTPS** (note: this option becomes active a few minutes after your custom domain DNS propagation completes).
Pro-Tip: Handling DNS Propagation Delays
DNS updates do not happen instantly. It can take anywhere from a few minutes up to 24 hours globally for your new DNS configuration to propagate. If your site isn't loading immediately after setup, don't panic! Use tools like dnschecker.org to track how your records are resolving worldwide.

Comments
Post a Comment