部署到服務器 404 后會出現 Flutter Web 我知道 Flutter 是單頁應用,所以我們配置了 .htaccess 檔案
RewriteEngine on
RewriteCond %{REQUEST_FILENAME}% !-d
RewriteCond %{REQUEST_FILENAME}% !-f
RewriteRule . /index.html [L]
但是我在應用程式中使用了一個靜態 html 檔案渲染,所以這個方法不起作用,我也嘗試了 404.html。沒用請幫幫我
uj5u.com熱心網友回復:
RewriteCond %{REQUEST_FILENAME}% !-d RewriteCond %{REQUEST_FILENAME}% !-f
您%在TestString引數的末尾有一個錯誤的文字,因此這些否定條件將始終成功,包括將請求重寫為/index.html.
這些條件應該寫成:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
但請注意,要正確重寫對檔案根目錄的請求,您需要確保DirectoryIndex正確設定了 。例如:
DirectoryIndex index.html
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/403320.html
標籤:
