VUE靜態資源打包部署在tongweb上重繪頁面404問題問題現象
F5重繪就會出現404
問題處理方法
方法一:default-web.xml添加error-page標簽
<error-page>
<error-code>404</error-code>
<location>/index.html</location>
</error-page>
方法二:web.xml添加error-page標簽
在應用WEB-INF檔案下添加web.xml,在web.xml中添加error-page標簽
<error-page>
<error-code>404</error-code>
<location>/index.html</location>
</error-page>
(web.xml優先于tongweb的default-web.xml)
???????方法三:利用tongweb的rewrite功能實作
在應用WEB-INF檔案下添加rewrite.config,內容如下:

???????方法四:利用ths的rewrite_mod模塊實作
<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的try-files模塊實作
location / {
try_files $uri $uri/ /index.html;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/317858.html
標籤:其他
上一篇:簡單使用Docker
下一篇:http協議的狀態碼
