#uniapp history模式下刷新頁面404#

問題: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;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章