In a previous post I explained how to use relative paths, and created a small static site to help the explanation.

Today I added that site as a subdomain of I like the idea of someone potentially arriving at the paths example site, and then exploring aloneinthesea from there.

Since I already shared the previous URL of the site, I want for both URLs to work but for the old one to redirect to the new one. To achieve this I added this simple script in the head of the index file:

<!-- index.html -->
<!-- ... -->
    // Check if the current URL is the GitHub Pages version
    if (window.location.hostname === '') {
        // Redirect to the Render version with custom domain
        window.location.href = '';
<!-- ... -->

Side note: the Paths site is now hosted in Render. In the future I might move all projects to the same hosting service to manage all projects from the same web app.