Search code examples
sslhttpsdnsgithub-pages

Secure https redirect with github pages and letsencrypt doesn't work


I have two domains: example.com and example.org.

HTTP://www.example.com redirects to HTTPS://www.example.org (as expected)  
HTTP://example.com redirects to HTTPS://www.example.org (as expected)  
HTTP://www.example.org redirects to HTTPS://www.example.org (as expected)  
HTTP://example.org redirects to HTTPS://www.example.org (as expected)  
HTTPS://example.org redirects to HTTPS://www.example.org (as expected) 

However, using HTTPS doesn't work. I think this is because I haven't proven that I own example.com to my CA (letsencrypt through GitHub pages).

HTTPS://www.example.com should redirect to HTTPS://www.example.org  
HTTPS://example.com should redirect to HTTPS://www.example.org  

This question is related but it goes a little over my head and I'm not sure how to implement it on Github pages with Namecheap.


Solution

  • I solved this by migrating to netlify. I recommend.

    I used the information here and here to create a _redirects file that looks like this:

    https://example.com/* https://www.example.org/:splat 301!
    https://www.example.com/* https://www.example.org/:splat 301!
    http://example.com/* https://www.example.org/:splat 301!
    http://www.example.com/* https://www.example.org/:splat 301!