Reputation: 9149
I'm using react-router
to organize my web application with the following structure:
<Router history={createBrowserHistory()}>
<Route path="/" component={AnyPic}>
<IndexRoute component={PhotoList} />
<Route path="p/:photoId" component={PhotoView} />
</Route>
</Router>
This works fine, but I am having trouble linking directly to a URL matching p/:photoId
. Let's say I have localhost:8000/p/xyz
loaded on my webpage. If I refresh the page or link directly to it, I get a 404
error. I understand this is because there is no p
directory. Any way I can fix this issue?
Upvotes: 2
Views: 290
Reputation: 2837
You're missing the server-side configuration for createBrowserHistory
. See the documentation at https://github.com/rackt/react-router/blob/v1.0.0/docs/guides/basics/Histories.md#configuring-your-server.
Upvotes: 4