FlutterIntermediate 3 min read

Deploy Flutter web to shared hosting: subfolders and release checks

Prepare a subfolder build, scope URL fallback rules and verify caching without replacing your existing website.

On this page

Flutter web release output can be served as static files. Your existing website and a browser app can share a host if each keeps its own routes, assets and server configuration.

Reserve an application folder

This example uses /apps/demo/ for a separate application. It is not the tutorial directory. Build with the matching base path, including both slashes:

flutter build web --release --base-href /apps/demo/

Review build/web, then upload its contents into the server’s public_html/apps/demo/ folder. The generated index.html belongs immediately in that folder. Keep a backup or deploy to a staging directory before replacing an existing app release.

With Flutter 3.50, evaluate --web-content-hash for versioned bundles and assets. For example: flutter build web --release --web-content-hash --base-href /apps/demo/. The current web deployment guidance explains the generated names and cache contract. Keep index.html and flutter_bootstrap.js revalidated; an immutable cache rule belongs only to versioned content.

Configure only the app’s path fallback

If you selected path URLs and your shared host runs Apache with rewrite support, an app-local .htaccess can use the following pattern:

RewriteEngine On
RewriteBase /apps/demo/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.html [L]

Place it inside /apps/demo/, not the website root. Check the host’s allowed directives first. Existing files and directories bypass this fallback. Without path routing, the hash strategy may avoid the need for a client-route fallback.

Verify the release as a visitor

Open the app root, paste a nested route into a new tab and refresh it. Check that scripts, fonts, images and .wasm files return correct content types. A 200 response containing HTML for a missing script is still a failed asset request.

Test a real API request using the production origin. CORS is an API/server configuration concern; changing the Flutter widget does not grant a browser cross-origin access. Keep provider credentials and privileged backend operations outside downloadable browser code.

Plan cache updates with Cloudflare

The web deployment guidance covers current release output and content-hashing options. Use long immutable caching only for assets whose URLs change when their content changes. Revalidate entry HTML and bootstrap files so returning visitors can discover a new release.

Deploy the output as one coherent version. Test a returning browser as well as a clean profile; stale bootstrap code paired with new assets can fail differently from a first visit. Do not add a blanket Cache Everything rule to the whole FlutterFever domain just for this app.

Application and content have different jobs

Keep tutorial articles in semantic static HTML. A Flutter web canvas is suitable for interactive application behavior, while an article needs headings, crawlable links and directly available reading content. If you need a Dart document framework, the related official-channel video introduces Jaspr as a different option.

Release exercise

Prepare a checklist covering HTTPS, subfolder assets, nested refresh, API origin, a slow first visit and an upgrade from the previous release. Confirm rollback before announcing the new application. The commands here are tutorial instructions; this lesson does not deploy anything to your host.

How this topic connects

Understand first

Apply it next

Lesson progressMark complete after checking the example and exercise.

Build your next website with Dart & Jaspr · Flutter · official channel

Preview image only. YouTube loads when you press Play.

An additional perspective on document-based Dart websites. Jaspr and Flutter web serve different rendering and content needs. Watch on YouTube

Find your next idea

Search lessons, code examples and projects.

Type a few words to start exploring.