wordpressgithub

How can I redirect my Github Page to a custom domain hosted in Wordpress?


I have a Wordpress site: https://myname.com/, which is the one that I use and update frequently. In addition, I have an older version of the same web in a Github page domain such as https://myname.github.io/. It is currently online but I do not update it anymore.

I would like to redirect the people entering in https://myname.github.io/ to https://myname.com/, so they cannot see the older version, but my official one. Is there a way to do it, without having to delete the Github site?

I also noticed that when I search myname in Google, it comes the Github Page version. Is there a way to make it show the https://myname.com/ page?

Thank you.


Solution

  • While this isn't a WordPress issue in anyway as it is specific to Github.

    Adding the below to your github page and replace yournewpage.com with the new domain should automatically redirect when someone vists. It will also help with anything crawling slowly updating to the new domain.

    <!DOCTYPE html>
    <meta charset="utf-8">
    <title>Redirecting to https://yournewpage.com/</title>
    <meta http-equiv="refresh" content="0; URL=https://yournewpage.com/">
    <link rel="canonical" href="https://yournewpage.com/">