Home > Back-end >  Flutter web 404 Not Found
Flutter web 404 Not Found

Time:01-04

Flutter Web after deploy in server 404 will appear I know flutter is single page application so we configure the .htaccess file

RewriteEngine on
RewriteCond %{REQUEST_FILENAME}% !-d
RewriteCond %{REQUEST_FILENAME}% !-f
RewriteRule . /index.html [L]

but I use one static html file render in app so this method is not working ​and also I tried 404.html. No use please help me

CodePudding user response:

RewriteCond %{REQUEST_FILENAME}% !-d
RewriteCond %{REQUEST_FILENAME}% !-f

You have an erroneous literal % at the end of the TestString argument, so these negated conditions will always be successful, including when the request is rewritten to /index.html.

These conditions should be written:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

But note that for requests to the document root to be correctly rewritten you need to ensure that the DirectoryIndex is correctly set. For example:

DirectoryIndex index.html
  •  Tags:  
  • Related