H
H
Haaaaz2022-02-23 17:41:36
React
Haaaaz, 2022-02-23 17:41:36

Route directly to the page?

Hello.
There is a website site.com. Through react-router-dom there is a route site.com/page
After landing the site on hosting, if you enter site.com in the browser, then everything is OK, the site is displayed. But if you enter site.com/page, then a 404 error pops up. As I understand it, in order to go directly from the browser to the route, you need some kind of backend language and prescribe everything there, right? If so, how then to implement SPA?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
gsaw, 2022-02-23
@haaaaz

Here are offhand examples of how to configure nginx and apache under SPA
https://gist.github.com/rambabusaravanan/578df6d24...
The idea is that you need to redirect all "/*" to the application itself. To the same index.html with the application. Otherwise, apache will first check if there is an index.html file in the path /page

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question