【发布时间】:2017-10-17 17:15:33
【问题描述】:
我的 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 配置中还缺少什么?
谢谢
【问题讨论】:
-
你应该选择一个正确的答案。感谢您的提问。