我的 React 应用程序在本地开发服务器上运行良好,但是当我将生产就绪文件直接转储到 Apache 的 htdocs 目录时它不起作用:
这是我所拥有的:
/var/www/index.html
/var/www/bundle.js
我有
DocumentRoot /var/www
在 /etc/apache2/sites-available/000-default.conf
事实是
1)。当我访问http://...com/ 时,将我路由到登录页面
2)。在我点击链接之后
<Link to="main"><button>Log In</button></Link>
浏览器位置字段中的内容变为:
http://...com/main
3)。现在,如果我重新加载这个 url ( http://...com/main ),我得到了
The requested URL /main was not found on this server
我在 React 中的循环:
<Router history={browserHistory }>
<Route path="/" component={TopContainer}>
<IndexRoute component={Login} />
<Route path='main' component={MainContainer} />
</Route>
</Router>
我在 apache 配置中还缺少什么?
谢谢