Photo by Muhammad Zaqy Al Fattah on Unsplash

How to transfer HTTPS traffic to a new domain with GitHub Pages

I’m not saying it’s a good idea, but sometimes it’s necessary.

The problem

I wanted to move my professional site from to and redirect traffic, but GoDaddy does not support HTTPS ➡️ HTTPS redirects. I could use GoDaddy’s redirect service, but anyone who went to an HTTPS link (say would get the scary “Your connection is not private” message, saying my website may be trying to steal their information. The browser, seeing that the user was going to an invalid HTTPS site, would warn them that their connection was not secure. If the user accepts the risk and moves on, they’d be redirected as expected, but this, of course, is not the behavior we want.

The (hacky) solution

You could spin up a DigitalOcean droplet, configure an Apache server, and set up SSL certificates exclusively for redirecting the domain. That could cost upwards of $50–60/year. If you’d prefer a simpler, free option, you may want to use GitHub Pages’ infrastructure.

By overwriting 404.html and implementing a custom domain, (view how to configure a custom domain with GitHub Pages), you can make sure that any traffic that goes to a your old domain passes through this webpage. From there, you can redirect as necessary.

View the repo.

View the 404.html

I wrote some simple JavaScript to dynamically edit the metadata tags so that any subpage of could redirected to the corresponding subpage of In case the metadata redirect doesn’t work, there’s some secondary JavaScript to provide a link where the user can redirect manually.

Don’t @ me (but please @ me)

While this all “works”, I have trouble believing this is the best solution to my problem. I expect this will hurt SEO, and I’m waiting for unintended side-effects. Thankfully, this duct-tape approach is sufficient for what I need right now. But I can’t be the first to have this issue, which makes me surprised that Googling for other solutions came up empty-handed. Am I missing something obvious? Please let me know!

Questions? Comments? Contact me and see more projects on my website (with a new domain 🙂)



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kevin McElwee

Kevin McElwee

🏳️‍🌈 Machine learning engineer and data journalist. Learn about me and my projects at