Pointing a custom domain to a GitHub Pages hosted site
How to point a personal domain to your site that you host on GitHub pages. Easy setup.
Pointing a Custom Domain to a GitHub Pages Site
Situation:
You own a domain (e.g., example.com) via a registrar like Namecheap, and your site is hosted on GitHub Pages (e.g., yourusername.github.io).
Steps:
Login to your domain registrar (e.g., Namecheap)
Go to Domain List > Manage > Advanced DNS
Delete any default A or CNAME records
Add A Records for GitHub Pages:
Host: @
Values (add one A record for each IP):
185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153
TTL: Automatic
Add a CNAME Record:
Host: www
Value: yourusername.github.io
TTL: Automatic
In your GitHub repo > Settings > Pages:
Set Custom Domain to: example.com
GitHub will automatically enable HTTPS
Add a CNAME file to your repo (if not already):
Filename: CNAME
Contents: example.com
Commit and push
Wait 15–60 minutes for DNS to propagate
Visit your domain and check HTTPS and redirects
Pointing a Domain to a Site Hosted on Your Own Web Server
Situation:
You own a domain and run your own web server (e.g., on a home server or cloud VPS).
Steps:
Find your public IP address of the web server
Login to your domain registrar
Go to Domain List > Manage > Advanced DNS
Delete any existing A records
Add A Record:
Host: @
Value: your server’s IP address (e.g., 123.45.67.89)
TTL: Automatic
Optional: Add CNAME for www
Host: www
Value: example.com
TTL: Automatic
Ensure your server is configured to serve content for that domain
- Update Apache, NGINX, or similar config
Set up HTTPS with Let’s Encrypt (optional but recommended)
- Use Certbot or similar
Wait a few minutes and test the domain
Pointing a Domain to a Budget Web Host (e.g., Bluehost, HostGator)
Situation:
You own a domain and want it to point to a site hosted on a shared Linux web host.
Steps:
Login to your web host account
- Find the DNS settings, IP address, or nameservers in your hosting dashboard
Login to your domain registrar
Option A: Use Nameservers (recommended by hosts)
Replace your registrar’s default nameservers with those provided by the host
Example:
ns1.hostgator.com
ns2.hostgator.com
Wait for propagation (up to 24 hours)
OR
Option B: Use A Record (manual setup)
Host: @
Value: your host’s IP address
TTL: Automatic
Optional: Add CNAME
Host: www
Value: example.com
Configure your site within the hosting control panel
- Set the domain to point to the right directory
Wait for DNS to propagate
Visit your domain and verify everything works