vue小笔记 打包之后,刷新页面出现404的问题

版权声明:本文为博主原创文章,未经博主允许不得转载。联系[email protected] https://blog.csdn.net/div_ma/article/details/78406559

官网解决方案

https://router.vuejs.org/zh-cn/essentials/history-mode.html

需要在后端进行配置

Apache

<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

location / {
  try_files $uri $uri/ /index.html;
}

猜你喜欢

转载自blog.csdn.net/div_ma/article/details/78406559