Flutter Web Page Routing Issue


I need web app with base url as


I updated my base url as documented in flutter website:

 <base href="/mojjo-test/">

in index.html

As per flutter documentation Hashing is already enabled


1.Flutter web app loads, shows url while loading,


2.And after some seconds it redirects to

  1. Now if we do a refresh, browser will try to load http://example.com/mojjo-test/#/ and shows an access denied

I am assuming that instead of redirecting to http://example.com/mojjo-test/#/, it should redirect to http://example.com/mojjo-test/index.html#/

Please provide suggestions on how to achieve it. I would like to keep the initial path to be https://example.com/mojjo-test/index.html#/ (with index.html)


I’d advice you commenting out href in ‘web/index.html’ (platform project automatically generated when adding Web). That’s how I did it:

And here’s the example of this app working under virtual directory:

Flutter Web somehow has these silly issues in scaffolding for the web project (href in index.html, wrong paths for service worker etc.) – discovered this while playing with GitHub pages.

Answered By – Maxim Saplin

Answer Checked By – Marie Seifert (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.