I am using Symfony3 and I am creating a package using React.js using my own reactive router.
The problem is that I use routing in the reaction, if I reload the page, the symfony routing module will send "No Route Found"
My routes are / admin for the index page and / admin / data for the next page.
When I load the page / admin, everything is fine, I click on the link to go to / admin / data, everything works, react to me dynamically, but now when I refresh the (F5) page / admin / data, Symfony intercept it and try to find the routing in your code and redirect to / 404 "No Route Found".
I know that on AngularJs the structure uses ancors Path "localhost: // admin / # / data", which seems easier to manage, but for interacting with the client "localhost: // admin / data"
My symfony routing:
admin:
path: /admin
defaults: { _controller: BiBundle:Admin:default }
My React routing:
import { Router, browserHistory } from "react-router";
<Router history={browserHistory}>
<Route path="/admin" component={App}>
<IndexRoute components={{content: DashboardPage}} />
<Route path="data/list"
components={{content: DataListPage}} />
<Route path="*"
components={{content: _ => <h1>Page not found.</h1>}} />
</Route>
</Router>
My link page / admin:
<Link to={'/admin/data/list'}>Data</Link>
I was thinking of changing my .htaccess to redirect everything / admin / * to / admin, but there seems to be too much for this problem.
I also use Apache2 server.
EDIT
I replaced browserHistory hashHistory
import { Router, hashHistory } from "react-router";
<Router history={hashHistory}>
<Route path="/" component={App}>
<IndexRoute components={{content: DashboardPage}} />
<Route path="data/list"
components={{content: DataListPage}} />
<Route path="*"
components={{content: _ => <h1>Page not found.</h1>}} />
</Route>
</Router>
This led to a change in my path since it is used in AngularJs (or close enough), so now I have / admin # / and / admin # / data / list, so symfony always catch / admin and response-router catch # / or # / admin / data p>
What do you think? Is this a good methodology?