問題:uniapp 的history 把#去掉了,但是當刷新頁面的時候出現404
解決方案
需要服務端支持
如果 URL 匹配不到任何靜態資源,則應該返回同一個 index.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;
}