You are here: / Articles / Guides / How to Enable Gzip Compression on Your Website

How to Enable Gzip Compression on Your Website

Gzip Compression


No one in their right minds enjoy the experience of being tormented by a slow loading website and that is why we cannot help but help out with a guide on gzip compression.

You as the website developer would be most concerned in keeping visitors on your website knowing they have short attention spans. Visitors to are notorious for abandoning websites if the page does not load in a few seconds in the least so this puts a lot of pressure on the developer to ensure this does not happen.

There are several ways to make your website run faster but this one method of gzip compression returns great rewards of up to 70% response size all for relatively little effort. I say little effort on the server end because you really need to configure this once and let the technology work itself.

Read Also  Hurry: Why You Need to Upgrade to Windows 10

On the side of the user, it is important to note that all modern web browsers support gzip compression so there is really nothing to be done on that end.

Enabling Gzip Compression for Your Apache Driven Website

Apache is a popular web server primarily used on Linux and Unix based operating systems even though it is fully usable on Windows operating systems. To started you need to edit the .htaccess file on your root. Next you need to check for the deflate module and if it is there tell the server which types of files should be compressed and that is as much as there is to it.

You can check the deflate module using:

<ifmodule mod_deflate.c>
 … add your directive here

The directive then looks something like this:

Read Also  Another GameWorks VR 1.1 Update up for Grabs

AddOutputFilterByType DEFLATE [file mime types seperated with spaces] like this text/css application/x-javascript application/javascript.

Believe it or not that’s it. save the .htaccess file and you are done.

Here is a comprehensive list of mime types in a working .htaccess file that you can adopt for your website. You can add or remove any mime types you wish to or not to compress. It was originally posted here on GitHub where you can go in a fork it.