1

I have a Flutter portfolio app at suragch.dev and then a few other web apps in an apps subfolder. However, when I push the changes and try to visit the new Flutter app in the subfolder

https://suragch.dev/apps/mongoleditor/

it returns to the root Flutter page. In the past I didn't have this problem. In fact, another flutter app in the apps folder works fine:

https://suragch.dev/apps/mongolcode/

How do I fix this?

I found the answer and will add it below.

Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393

1 Answers1

1

Now when you build a Flutter web app that isn't being served from the root, you need to change the base in the app's index.html file. This is described in that file's comments:

If you are serving your web app in a path other than the root, change the href value below to reflect the base path you are serving from.

The path provided below has to start and end with a slash "/" in order for it to work correctly.

For more details:

So just change this:

<base href="/">

to this:

<base href="https://suragch.dev/apps/mongoleditor/">
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393