Q
Q
qfrontend2019-08-11 13:21:49
JavaScript
qfrontend, 2019-08-11 13:21:49

Why does the hosting get a 404 error when refreshing the ReactRouter page?

Greetings)
There is an application on reacr\redux. uploaded to hosting.
If you follow the links , then everything is fine.
But if you refresh the page at the address for example "/portfolio" , then it gives an error (404. That's an error. The requested URL was not found on this server).
Although on the local server, pages are rendered when updated.
I would be very grateful for your help :)

return (
      <Router>
        <div className="App">
          <BgCosmos />
          <header>
            {responsive === false ? (
              <Nav props="" />
            ) : (
              <Touch isOpenNav={isOpenNav.bind(this)} open={openNav} />
            )}
          </header>
          {responsive && (
            <Nav open={openNav} isOpenNav={isOpenNav.bind(this)} />
          )}
          <NavSocial />
          <Route>
            <div className="content">
              <Switch>
                <Route exact path="/" component={Baner} />
                <Route path="/portfolio" component={Portfolio} />
                <Route path="/about-us" component={AboutUs} />
                <Route path="/contacts" component={Contacts} />
              </Switch>
            </div>
          </Route>
          <WriteNow />
          <footer>
            <NavSocial />
          </footer>
        </div>
      </Router>
    );

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2019-08-11
@qfrontend

https://www.serverlab.ca/tutorials/linux/web-serve...
https://stackoverflow.com/questions/44038456/how-t...
Google - configure Nginx(Apache) for React(Angular)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question