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