unlike my github project here,
you may as well use your Apache’s (or nginx) htaccess rules to apply something called output filter,
…and its quite easy!
Here is how to compress files by mimetype (prefered method):
- first, add an empty file named
.htaccess, the placement which you’ll need to add it varies, the rule-of-thumb is “it applies recursively downwards all folders”, so, for the moment, let us create a designated folder named “my_gzip_content” under you web-site tree, down at your host-provider (just FTP for that..), following with creating an empty file (you can do it in the server or just copy an empty text file from your PC using FTP and renaming it
- edit, the file adding this content to it:
all you have to do is place
.htm, .html, .txt, .text, .css, .json, .js, .xml, .xhtml, .vnd, .ttfunder that folder, and once you’ll browse it, your server will serve it along with the “gzip header”, and of course- also compress it using common deflate gzip compression methods,
your browser will get a compressed content (binary) along with several headers that reminds it that it should handle the content as compressed (meaning, decompress before use), and you can save a large amount of traffic, and serve your website a lot faster, which is a plus for Google-crawlers, that will mark your website higher thanks to this..