I have an React app with different pages (ROUTER). I can go from a page to another, refresh the page and everything is working totally fine in local.
If I deploy the app npm run built and upload it to my host infinityfree.net all the time I want to refresh a page or use a direct link I get a 404 ERROR.
I tried catch all routes but it is not working
class App extends React.Component {
render() {
return (
<Router>
<div className="container">
<ul>
<li><Link to="/">Main</Link></li>
<li><Link to="/about">About</Link></li>
<li><Link to="/SomethingElse">Something else</Link></li>
</ul>
<hr />
<Switch>
<Route exact path="/" component={Main} />
<Route path="/about" component={About} />
<Route path="/SomethingElse" component={SomethingElse} />
</Switch>
</div>
</Router>
);
}
}
Any tips? Thank you!