react-gh-pages
react-gh-pages copied to clipboard
page deployed but paths doesn't work
Hi,
I deployed my page (https://lberthaut.github.io/projetsportsee/), and put component's paths with Routes. The homepage is goodly deployed but I should be able to change pages by adding a uri (12 or 18 by choosing one of the two first names on the homepag). But when I do, a github 404 error is displayed. In localhost, I have not this matter.
React-gh-pages should handle this or is it not supported? did I make a mistake during deployment?
My Repo : https://github.com/lberthaut/projetsportsee (paths is in projet-sportsee/src/app/)
Hi! Im newbee, But i think you need to enable browserrouter in main js file like this. <BrowserRouter> <App /> </BrowserRouter> I think your main app dont know what you use routing, and it works on your local server, but when you upload on ghp this is doesn't work.
This is just assumption...
Hi @lberthaut, thanks for including links. I see what you mean.

The react-gh-pages tutorial doesn't address routing. However, I do have some experience with it, including on GitHub Pages.
I think you have two options:
- (A): Use React Router's
<HashRouter>instead of<BrowserRouter>. -- OR -- - (B): Continue using React Router's
<BrowserRouter>, and employ the "trick" described in https://github.com/rafgraph/spa-github-pages (the trick involves adding specific code to the<head>section of yourindex.htmlfile, creating a404.htmlfile containing specific code, and passing abasenameprop to the<BrowserRouter>element)
Hi @up4k73, thanks for sharing your hypothesis.
@gitname I am facing the same issue. When I use HashRouter it doesn't redirect at all. https://github.com/mssrprad/Blog