This is so much easier than I was expecting it to be.
I launched my new Datasette Lite project (background) using GitHub Pages - originally hosted here:
Shortly after launching I realized that the project deserved its own vanity subdomain. I wanted to use
lite.datasette.io for this.
GitHub Pages makes this really easy.
I started by pointing the
simonw.github.io - I use Vercel for that domain, so I set this up in their interface.
Then I used the Pages tab in the "settings" interface for the GitHub repository and told it about my new domain.
GitHub wrote a file called CNAME directly into the root of my repository for me containing just
This started working over HTTP straight away - it took a few more minutes for the Lets Encrypt certificate to be issued for it, at which point https://lite.datasette.io/ started working too.
I then used the "Enforce HTTPS" option to ensure any hits to
http://... were redirected to
GitHub Pages set up redirects from the old https://simonw.github.io/datasette-lite/ site to the new one without me even asking them to.
The redirects preserve both query string parameters AND fragment hashes, which means that this old URL continues to work after the move:
It redirects to:
Created 2022-05-04T15:25:38-07:00 · Edit