Search code examples
githubhttp-redirectgithub-pagescustom-domain

Redirect Github homepage to custom homepage


I used to host my webpage on username.github.io.

I have now set up a new webpage on username.com, and has no relation to username.github.io.

However, I want to redirect username.github.io to username.com.
As of now, if somebody enters username.github.io, it takes you to the 404 not found page.

Is there anyway I can reroute it to username.com?


Solution

  • Instead of a redirect, the normal process is for your current GitHub pages to use a custom domain

    You find a better illustration of that process here

    • Go to your GitHub Pages site’s repository settings.
      Under “Custom domain”, add or remove your custom domain and click “Save”.
    • Setting “custom domain” creates a file named CNAME in the same repository.
      Don’t delete it.

    The OP sidv adds in the comments:

    After setting up my website (deployed elsewhere) and the DNS servers, I was unable to open the webpage on Safari and Firefox (only on Chrome).

    Finding the load balancing IP and configuring it as an A record ended up redirecting the webpage appropriately.