Skip to content

page deployed but paths doesn't work #104

Open

Description

@lberthaut

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/)

Activity

  1. up4k73 commented on Aug 2, 2022

    @up4k73

    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...

  2. gitname commented on Aug 3, 2022

    @gitname
    Owner

    Hi @lberthaut, thanks for including links. I see what you mean.

    image

    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 your index.html file, creating a 404.html file containing specific code, and passing a basename prop to the <BrowserRouter> element)

    Hi @up4k73, thanks for sharing your hypothesis.

  3. self-assigned this
    on Aug 6, 2022
  4. MSSRPRAD commented on Jun 4, 2023

    @MSSRPRAD

    @gitname I am facing the same issue. When I use HashRouter it doesn't redirect at all. https://github.com/mssrprad/Blog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions