In this tutorial we will go through deploying Unity & Godot WebGL games on ANY web host that gives you access to the file system, allows you to upload and edit files in the file system, and allows you to access and edit the .htaccess file (if using apache). This tutorial isn’t designed for non-apache servers. This tutorial should work for most common webhosts such as Hostinger, BlueHost, HostGator, DreamHost, IONOS, etc.

Exporting Your Game for WebGL

Before uploading your Unity or Godot game to the web, you will first need to export it to webgl. I have linked some great tutorials on how to export your Unity and Godot games to webgl below:

Godot Export to WebGL Video: https://www.youtube.com/watch?v=eI0jDvpFh6A

Godot Official Docs: https://docs.godotengine.org/en/stable/tutorials/export/exporting_for_web.html

Unity Export to WebGL: https://www.youtube.com/watch?v=L82geOfpQCQ

The above Godot Export to WebGL video also covers uploading your Godot webgl game to Itch.io . Uploading our webgl games to most web hosts follows an extremely similar pattern.

Uploading the Game Files to a Webhost

Once you have exported your Unity or Godot game to webgl, login to your web host and navigate to the file manager. Once you are inside your host’s file manager, you will need to upload your exported webgl game. This may take a while, depending on upload speed, file size, etc. 

Note: This tutorial does not cover domain configuration, just be sure to either upload the files to your website root or sub directory. With webhosts like Hostinger, Bluehost, etc. they usually handle domain configuration for you, you can either purchase a domain or create a subdomain of an existing domain of yours, then just navigate to the site folder for the domain in the file manager and upload your files there.

.htaccess Config

Once you have the files uploaded we will need to configure the .htaccess file. We will configure the basic security settings and enable caching, the main difference between the htaccess file for unity / godot webgl games and say a WordPress site is that for the webgl games we need to enable the wasm MIME type. Below is a sample .htaccess for your unity / godot webgl game. You can find the same file on github here: https://github.com/Phoenix-Ignited-Tech/htaccess/blob/main/htaccess%20for%20unity%20-%20godot%20webgl%20games

Accessing Your Game

Once you have uploaded your webgl game files to your webhost and configured your .htaccess file, you can access your webgl game online! If you need a little help on how to access your webgl game I’ve included a little info just on that below:

For unity games the file structure looks something like: 

And for godot games it looks something like: 

The important files here are the Index.html in godot and the index.html file in unity. These are the main web page files. So when accessing your unity webgl game the address url might look like: mysite.com/path/to/myGame/index.html. For godot it might look like: mysite.com/path/to/myGame/Index.html. 

You can change the file names of these files, just remember the address urls will change also, so if you update index.html in unity to myGame.html it would look like: mysite.com/path/to/myGame/myGame.html.

For example let’s say I uploaded my webgl unity game to mysubdomain.mysite.com/games/ I also called my game directory MySuperCoolGame and I renamed my index.html file to MySuperGame.html. The full address URL to access my game would be: mysubdomain.mysite.com/games/MySuperCoolGame/MySuperGame.html.

That’s a wrap, I hope you enjoyed it, and as always let me know your thoughts! Happy Gaming!

Walter Miely is a tech entrepreneur and CEO of Phoenix Ignited Tech You can find him on Linkedin. This material is licensed under the CC BY 4.0 License LEGAL DISCLAIMER: The content provided here is provided AS IS, and part of, or the entirety of this content may be incorrect. Please read the entireLegal Disclaimer here.