HML5 compressed files- SyntaxError: illegal character

I’m getting this error when I try to run from my website -

SyntaxError: illegal character
SyntaxError: illegal character
SyntaxError: illegal character

My host is hostgator - the page works on 000webhost though. I tried to include a htaccess file with

AddType “text/javascript” .gz
AddEncoding gzip .gz

EDIT: So the uncompressed files work fine - I changed the const serveCompressedAssets to false - how can I get it running with the compressed files?
But still get the same error. Any ideas?

Shot of my files - I included everything to see if that might work.

If you get the Illegal Character error, it very likely means that the file was still getting served without “Content-Encoding: gzip” flag, so it sounds like the htaccess file was not getting used. You can verify that by using the Network tab of Firefox Developer Tools, in particular the Headers view of the request (see Network Monitor — Firefox Source Docs documentation). That list should show “Content-Encoding: gzip” present in the “Response headers” section, next to Date, Content-Type, Content-Length and so on.

You can cross-reference by using the Network details tab on the page http://mzl.la/webassemblydemo, which does use gzip compression with the served files (that one is hosted with Amazon AWS S3 service)

.htaccess isn’t appearing in the network tab- I’ve looked at it in Firefox and Chrome and can’t see htaccess in the tab. I don’t actually see htaccess for the demo either though but it is loading .gz files.

Amazon AWS S3 does not use .htaccess files to specify Content-Encoding, rather it has its own Metadata-based system (Working with object metadata - Amazon Simple Storage Service).

Iiuc .htaccess is a Apache web server specific configuration file.

Ah I see… HostGator uses Apache, so I’m not sure what I’m doing wrong - seems like .htacess should be fine to modify .htaccess Guidance | HostGator Support

What it could be is UE4 provides a htacess file, and hostgator creates one for a website by default. Maybe I’ve overwritten the default with the UE4 one and there’s something necessary in the default. I’ll see if I can find the original.

EDIT: I used the original but it still doesn’t seem to be loading in the network tab

I’ve been talking to my hosting company’s tech service but they coudn’t figure it out. I tried compressing everything in the filehost but get the same problem. It does look like this used to be pretty common but none of the solutions so far seem to work. What should actually be contained in the htaccess file?

I don’t know if the needed contents of .htaccess file can vary per hosting server (e.g. if Apache is configured differently, or different Apache versions), but looking at project files from one UE4 project that did use .htaccess with Apache, it seems to have the following in it:

AddType application/x-javascript .jsgz    
AddType application/octet-stream .datagz
AddType application/wasm .wasm
AddType application/wasm .wasmgz

RewriteEngine on 
# If client accepts compressed files 
RewriteCond %{HTTP:Accept-Encoding} gzip 
# and if compressed file exists 
RewriteCond %{REQUEST_FILENAME}gz -f 
# send .extgz instead of .ext 
RewriteRule ^(.+)\.(mem|js|data|symbols|wasm)$ $1.$2gz

AddEncoding gzip .jsgz 
AddEncoding gzip .datagz
AddEncoding gzip .memgz
AddEncoding gzip .symbolsgz
AddEncoding gzip .wasmgz

Though I have not tested or deployed this project in practice to verify it first hand.