Skip to content

Pointing a custom domain to a GitHub Pages hosted site

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:

  1. Login to your domain registrar (e.g., Namecheap)

  2. Go to Domain List > Manage > Advanced DNS

  3. Delete any default A or CNAME records

  4. Add A Records for GitHub Pages:

  5. Host: @

  6. Values (add one A record for each IP):

    • 185.199.108.153

    • 185.199.109.153

    • 185.199.110.153

    • 185.199.111.153

  7. TTL: Automatic

  8. Add a CNAME Record:

  9. Host: www

  10. Value: yourusername.github.io

  11. TTL: Automatic

  12. In your GitHub repo > Settings > Pages:

  13. Set Custom Domain to: example.com

  14. GitHub will automatically enable HTTPS

  15. Add a CNAME file to your repo (if not already):

  16. Filename: CNAME

  17. Contents: example.com

  18. Commit and push

  19. Wait 15–60 minutes for DNS to propagate

  20. 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:

  1. Find your public IP address of the web server

  2. Login to your domain registrar

  3. Go to Domain List > Manage > Advanced DNS

  4. Delete any existing A records

  5. Add A Record:

  6. Host: @

  7. Value: your server's IP address (e.g., 123.45.67.89)

  8. TTL: Automatic

  9. Optional: Add CNAME for www

  10. Host: www

  11. Value: example.com

  12. TTL: Automatic

  13. Ensure your server is configured to serve content for that domain

  14. Update Apache, NGINX, or similar config

  15. Set up HTTPS with Let's Encrypt (optional but recommended)

  16. Use Certbot or similar

  17. 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:

  1. Login to your web host account

  2. Find the DNS settings, IP address, or nameservers in your hosting dashboard

  3. Login to your domain registrar

  4. Option A: Use Nameservers (recommended by hosts)

  5. Replace your registrar's default nameservers with those provided by the host

  6. Example:

    • ns1.hostgator.com

    • ns2.hostgator.com

  7. Wait for propagation (up to 24 hours)

OR

  1. Option B: Use A Record (manual setup)

  2. Host: @

  3. Value: your host's IP address

  4. TTL: Automatic

  5. Optional: Add CNAME

    • Host: www

    • Value: example.com

  6. Configure your site within the hosting control panel

  7. Set the domain to point to the right directory

  8. Wait for DNS to propagate

  9. Visit your domain and verify everything works