Apache和Nginx下vue页面刷新出现404解决办法

温馨提醒

Apache 伪静态配置

1
2
3
4
5
6
7
8
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>

Nginx 配置

1
2
3
4
location /ui/xxx/ {
     alias /data/wwwroot/services/xxx/
     try_files $uri $uri/ /ui/xxx/index.html;
}