DEV Community

Cover image for HTTPS Domain Forwarding for Free via GitHub Pages
Alvin Lim
Alvin Lim

Posted on

HTTPS Domain Forwarding for Free via GitHub Pages

This week I decided to move my homepage from to

I remembered that my domain name registrar offered a free URL redirect service, and I decided to use that forward to While that worked for, clicking instead threw an SSL error.

Basically, for the URL redirect of to work, first had to be recognized by the browser as a valid website, and this meant it had to have a valid SSL certificate attached to it.

This meant I had to set up a website for, attach a SSL certificate to it, and configure the HTML to redirect the browser to 😅

This raised the question -- wouldn't setting up the website and SSL certificate be expensive? That's when I remembered that I could quickly set up a free website on GitHub Pages, connect it to my domain, and GitHub Pages would even provision and attach an SSL certificate to it for free! Since I already had the domain, I decided to go with this option.

So I created a new repo on GitHub which hosts an index.html file which is empty except for the important meta refresh tag which redirects the browser to the new URL:

<!DOCTYPE html>
    <meta http-equiv="refresh" content="0; URL=">
Enter fullscreen mode Exit fullscreen mode

I next created a GitHub Pages site from that repo and attached my domain to it. In the GitHub Pages settings I then selected the "Enforce HTTPS" option.

With all this in place, clicking no longer throws an SSL error but instead correctly redirects the browser to

Top comments (2)

sunnysingh profile image
Sunny Singh

Nice! You could also set up Cloudflare in front of your old domain which provides free SSL, and you could then have a real server redirect.

I do like the simplicity of GitHub Pages though with the meta redirect.

levirs565 profile image
Levi Rizki Saputra