# HML5 compressed files- SyntaxError: illegal character

**URL:** <https://forums.unrealengine.com/t/hml5-compressed-files-syntaxerror-illegal-character/406423>\
**Category:** Platform & Builds\
**Tags:** host, HTML5, compression, syntax, unreal-engine, question\
**Created:** [October 7, 2017, 4:14pm UTC](https://forums.unrealengine.com/t/hml5-compressed-files-syntaxerror-illegal-character/406423 "2017-10-07T16:14:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Donalf](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/donalf/32/879767_2.png) [@Donalf](https://forums.unrealengine.com/u/Donalf)\
**Post date:** [October 7, 2017, 4:14pm UTC](https://forums.unrealengine.com/t/hml5-compressed-files-syntaxerror-illegal-character/406423/1 "2017-10-07T16:14:34Z")

</div>

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.

 ![215968-host.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/b/c/4bc2cc888f1ed7838595cd94ed08073daa868cbb.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f0fea7ad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f0fea7ad](https://forums.unrealengine.com/u/anonymous_user_f0fea7ad)\
**Post date:** [October 8, 2017, 9:45am UTC](https://forums.unrealengine.com/t/hml5-compressed-files-syntaxerror-illegal-character/406423/2 "2017-10-08T09:45:41Z")

</div>

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](https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor#Headers)). 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](http://mzl.la/webassemblydemo), which does use gzip compression with the served files (that one is hosted with Amazon AWS S3 service)

---

<div class="post-metadata">

**Author:** ![Donalf](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/donalf/32/879767_2.png) [@Donalf](https://forums.unrealengine.com/u/Donalf)\
**Post date:** [October 9, 2017, 6:06pm UTC](https://forums.unrealengine.com/t/hml5-compressed-files-syntaxerror-illegal-character/406423/3 "2017-10-09T18:06:12Z")

</div>

.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.

 ![216176-network.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/a/3/8a3954d6ad108d5d7a5e78399d06d12c40363152.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f0fea7ad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f0fea7ad](https://forums.unrealengine.com/u/anonymous_user_f0fea7ad)\
**Post date:** [October 10, 2017, 11:31am UTC](https://forums.unrealengine.com/t/hml5-compressed-files-syntaxerror-illegal-character/406423/4 "2017-10-10T11:31:05Z")

</div>

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](http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html)).

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

---

<div class="post-metadata">

**Author:** ![Donalf](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/donalf/32/879767_2.png) [@Donalf](https://forums.unrealengine.com/u/Donalf)\
**Post date:** [October 10, 2017, 1:29pm UTC](https://forums.unrealengine.com/t/hml5-compressed-files-syntaxerror-illegal-character/406423/5 "2017-10-10T13:29:42Z")

</div>

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](http://support.hostgator.com/articles/-htaccess-guidance)

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

---

<div class="post-metadata">

**Author:** ![Donalf](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/donalf/32/879767_2.png) [@Donalf](https://forums.unrealengine.com/u/Donalf)\
**Post date:** [October 10, 2017, 4:02pm UTC](https://forums.unrealengine.com/t/hml5-compressed-files-syntaxerror-illegal-character/406423/6 "2017-10-10T16:02:32Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f0fea7ad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f0fea7ad](https://forums.unrealengine.com/u/anonymous_user_f0fea7ad)\
**Post date:** [October 11, 2017, 5:17pm UTC](https://forums.unrealengine.com/t/hml5-compressed-files-syntaxerror-illegal-character/406423/7 "2017-10-11T17:17:44Z")

</div>

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.
