Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

417
Visualizações
React Router v6 - Direct links to a subpage return a 404 error

For my wedding, I've created a small React app to provide guidance to the guests: https://louis-et-marianne.com/

Accessing my 2nd page https://louis-et-marianne.com/dormir only works from the homepage, but I get a 404 when accessing this page URL directly.

Any ideas?

Here is my App.js code where the routes are defined:

function App() {
  return (
    <div className="App">
      <Wrapper>
        <ThemeProvider theme={customTheme}>
          <CssBaseline enableColorScheme />
          <Link to="/" style={{ textDecoration: "none" }}>
            <Hero />
          </Link>
          <Container maxWidth="md">
            <Routes>
              <Route path="/" element={<Accueil />} />
              <Route path="/dormir" element={<Dormir />} />
              <Route path="*" element={<h1>Page not found.</h1>} />
            </Routes>
            <Box
              display="flex"
              alignItems="center"
              justifyContent="center"
              mt={6} mb={6}
              sx={{ transform: "rotate(13deg)" }}
            >
              <img src={betise} alt="Bétise de Cambray" width="100px" />
            </Box>
          </Container>
        </ThemeProvider>
      </Wrapper>
    </div>
  );
}

And here is the full project on Github: https://github.com/byloupom/l-et-m

Thanks!

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

its not a react js issue it has to do with the hosting provider not redirecting all the requests to the index.html file if this is hosted on github pages i dont think it supports this.

you can read it here https://github.com/isaacs/github/issues/408

about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda