Github Pages 404s when redirecting to custom domain with React #23988
-
Howdy friends! I have been putting together a React App that works when I load it from my Github repository (https://edmundweir.github.io/doe-website/) but when I try to load it at my custom domain (https://descendantsofearth.com/) 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)
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, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
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 Hope that helps. Good luck! :slight_smile: |
Beta Was this translation helpful? Give feedback.
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…