In this example, we are going to show you the easiest way to host the Flutter Web app on cPanel hosting. The Flutter web is not matured yet, but it is developing very rapidly. In this example, you will learn to deploy Flutter Web files to cPanel/VPS hosting.
Read this also: How to deploy Flutter Web App on VPS Server with Domain Name
1. Build Web App
In command prompt hit the command below to generate files to deploy on cPanel/Hosting server.
flutter build web
Now, it will generate files at your_project/build/web/. Files may look like below:
2. Edit index.html and Remove <base> Tag:
Open index.html with your code editors like VSCode or Notepad and remove the code line.
Remove this line from index.html
3. Buy Hosting
There are lots of web hosting on the market, I suggest buying one among the following hostings.
When you buy Hosting from it, it will provide you the cPanel login.
4. log in to cPanel and go to FIle Manager
Log into cPanel with credentials provided by the Hosting provider, and go to "File Manager".
6. Upload file to public_html folder:
In the file manager, go to the public_html folder and upload all the build files.
7. Now open Your Domain.
Now open your primary domain or any domain pointed to public_html folder. Here is the example we have uploaded.
https://deploy-example.fluttercampus.com/ (Wait for few seconds on slow Loading)
In this way, you can host your Flutter Web app to cPanel hosting or any kind of hosting.