【发布时间】:2023-03-20 01:31:01
【问题描述】:
我在 ubuntu(apache2 服务器)上部署了 vue cli 项目 vue路由模式改变后,除了index之外的所有页面,在reload时都显示404页面。
我将 .htaccess 添加到 index.html 所在的 /dist 路径,但它仍然无法正常工作 我不知道还能做什么来解决这个问题。 有人知道吗?
这是我的项目 dist 文件夹
/home/admin/web/mali-nali.com/public_html/dist
dist 中的.htaccess 代码
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
这是 htacccess.madewithlove.be 调试信息
RewriteEngine On RewriteEngine was now turned on
2 RewriteBase / Using / as the base for the rewrites.
3 RewriteRule ^index\.html$ - [L] This rule was not met.
4 RewriteCond %{REQUEST_FILENAME} !-f This condition was met.
5 RewriteCond %{REQUEST_FILENAME} !-d This condition was met.
6 RewriteRule . /index.html [L] The new url is https://mali-nali.com/index.html
The tests are stopped because of the L in your RewriteRule options.
所有不存在页面的最后一条路径
{path: '/*',component:FourohFour, name:'404'}
【问题讨论】:
标签: apache .htaccess vue.js vue-router