What is Gzip compression?
How does Gzip compression work?
Developers from Google - Simply put, gzip compression works by finding similar strings within a text file, and replacing those strings temporarily to make the overall file size smaller. This form of compression is particularly well-suited for the web because HTML and CSS files usually contain plenty of repeated strings, such as whitespace, tags, and style definitions.
Enabling Gzip with .htaccess on Apache webservers
You can enable Gzip compression by adding a bit of code to the .htaccess file on your webhost/server.
Add the following code to your .htaccess file to enable Gzip compression:
Note: If you are not familiar with the .htaccess file please read this excellant article on feedthebot.com: How to use the .htaccess file
Enabling Gzip NGINX webservers
Note: credit for this piece of code should go to Patrick Sexton from feedthebot.com
Enabling Gzip with PHP
It is also possible to enable Gzip using PHP. This can be useful if you are not able to access or use an .htaccess file on your webhost/server.
The following code snippet should be used at the top of your PHP pages. (Don't forget to place it between the PHP tags)
Some resources with more information on Gzip compression: