0

I just linked a custom domain I got from google domains to a github pages react app. Currentely, when I go to the custom domain, the homepage of the website works fine, however, when I click on any links, firstly, the react-router doesn't change pages. And Secondly, when I reload the page, it still just loads the homepage and returns a 404 error.

Here is the repository with all the code: https://github.com/Been-H/ridge-road-journal-website

And on google domains, I have these as my type A records:

185.199.108.153 185.199.109.153 185.199.110.153 185.199.111.153

And this as my CNAME I have host name www and the data is my github (been-h.github.io

Does anyone know why only the homepage is working and nothing else? Thanks!

Been-H
  • 87
  • 9
  • 1
    You should use a `HashRouter` for apps running in Github pages. Does this help answer your question? https://stackoverflow.com/a/71985764/8690857 – Drew Reese May 13 '22 at 19:04
  • Just made the change, however, it still isnt routing to other pages besides home. Also, when I go to the network tab of dev tools, when I click any links, it doesn't make a call for the info on the new page, I have to refresh that page. Even then, it is still giving me 404 error – Been-H May 14 '22 at 22:15
  • Actually @DrewReese it is now working for all pages except for one, the author-dash page. When I click on it, the code runs history.push('#/na') and it returns this in the url: https://ridgeroadjournal.org/na#/. Do you know why this is happening? – Been-H May 14 '22 at 22:51
  • I don't think you need the `"#"` in the target path. Try just `history.push("/na");`. – Drew Reese May 15 '22 at 18:56
  • Your "homepage" in package.json should be your custom domain – matdev Apr 05 '23 at 13:56

0 Answers0