Github Pages 404s when redirecting to custom domain with React

Howdy friends!

I have been putting together a React App that works when I load it from my Github repository ( but when I try to load it at my custom domain ( it 404s, saying ‘file not found’.

Steps that I have taken: (NOTE: I had to break up the links here to circumvent the 2-link limit for noob posters)

  1. Added ‘descendantsofearthdotcom’ as a CNAME to root
  2. Set ‘homepage’ in package.json to ‘https:// descendantsofearthdotcom/’ — however this then led to my Github repository white-paging and my custom domain continuing to 404, so I have set the ‘homepage’ back to ‘https:// edmundweirdotgithubdotio/doe-website/’ for the time being
  3. Configured the following DNS settings with Google Domains:
    (removed by moderator)

I have also gone through every one of the numerous threads on the subject to the best of my abilities and come up dry, so any help with the issue would be immensely appreciated.

Many thanks,

After much head scratching, I have solved the issue!

I’m a total noob at Git as a solo worker, but I believe the problem may have been that the deploy scripts in package.json are targetting the ‘gh-pages’ branch of my repo, which was basically empty (everything was in the master branch).

What I did to fix it: Repository Settings >> Github Pages >> Source: gh-pages (instead of master). Then, since I had built everything on the master branch of my repo (instead of gh-pages) I set my gh-pages branch to match my master with ‘git reset –-hard master’ in the terminal, followed by git push -f origin branch_name to force-push my gh-pages to upload to the origin and overwrite the random changes it had in it. I did manage to actually overwrite my master with an empty branch in the process, which was a bit of a scary time until I figured out how to use git revert. Then, finally I changed “homepage” in package.json to my custom domain and Bob’s yer’ uncle.

Hope that helps. Good luck! :slight_smile:

1 Like