我在 apache 服务器上托管我的 vuejs 项目。
- 初始化项目
- 设置路由器
- 构建并托管到 apache 服务器
const router = new VueRouter({
routes: Routes,
// relative: true,
mode: 'history'
});
这在本地运行良好,但 vue 路由器在服务器上中断。例子
如果我运行 http://example.com 并转到 http://exmaple.com/sub 它工作正常
但是如果我刷新页面它会抛出 404 错误。
原文由 Shiv Shankar 发布,翻译遵循 CC BY-SA 4.0 许可协议
从 vue.js 文档页面:
阿帕奇