Iftekhar
Iftekhar

Reputation: 86

seturlstrategy- page reload not working :Flutter web 2.0

I have used setUrlStrategy(PathUrlStrategy()); to remove # from the url, but since then my pages stopped reloading after I deploy my project on web, it shows 404 page not found. but works perfectly on localhost. if I remove setUrlStrategy(PathUrlStrategy()); and build again to deploy on web it works. but that # shows on url. Can anyone help?

p.s: I used my project on non root location, and have already added my project name in index file, my project works if I open first page to next file, but not directly when open next file from url.

Upvotes: 1

Views: 1484

Answers (1)

Iftekhar
Iftekhar

Reputation: 86

ok i found the problem, it was because i didn't use .htaccess file.

here is htaccess code if anyone get same problem.

RewriteEngine On
RewriteBase /myproject/
RewriteRule ^index\.html$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /myproject/index.html [L]
</IfModule>

put this file where your index file is.

Upvotes: 4

Related Questions