DEV Community

Cover image for HTTPS Domain Forwarding for Free via Netlify
Alvin Lim
Alvin Lim

Posted on

HTTPS Domain Forwarding for Free via Netlify

This evening GoDaddy reminded me of an unused personal domain, alvinlim-writer.com, which is due to expire late next year. Several years ago I had used it for my personal website, and it still appears as a search result on Google. As such I decided to forward this domain to my current website alvinlim.dev.

I had previously done this with another domain via GitHub Pages, but this time I decided to go with Netlify as I suspected doing so would be easier.

So first I created a bare bones index.html file containing a meta refresh tag that would load my target URL:

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="refresh" content="0; URL=https://alvinlim.dev">
  </head>
  <body></body>
</html>
Enter fullscreen mode Exit fullscreen mode

Then in Netlify I deployed this index.html file as a running website. Usually I deploy projects to Netlify by connecting to the appropriate repo on GitHub, but for this I just clicked the Sites tab and dragged and dropped the folder containing the index.html file into the following button:

Folder upload button on Netlify

Once the index.html file was deployed as an active website -- just a few seconds later -- Netlify gave me the option to set up a custom domain for this website. This was my opportunity to connect my old domain alvinlim-writer.com to this index.html file which would automatically redirect the user to my current website alvinlim.dev.

To set up this custom domain, Netlify gave me the A and CNAME records that I would need to set up in my domain name registrar, in this case, GoDaddy. In GoDaddy, I set up the Netlify A and CNAME records in my alvinlim-writer.com management panel, and almost immediately the URL pointed to the website I had set up in Netlify! Which meant typing alvinlim-writer.com in the browser would automatically redirect you to alvinlim.dev.

From my recollection, setting this up on Netlify was much easier than doing the same on GitHub Pages. Having said that, setting up HTTPS domain forwarding on GitHub Pages can't be described as a difficult task either!

Discussion (0)