Activate gzip compression to make your website load faster. When gzip compression is activated, the contents of your website are packaged much like in a ZIP file, reducing the amount of data that needs to be transferred. This allows your website to load faster, particularly with slow Internet connections.

Activating Compression via .htaccess

Create a .htaccess file with the following content. If you already have a  .htaccess file, you can supplement the existing file with the following code block.

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/shtml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

If you need to replace the .htaccess file, upload this file to the website directory. Further information is available in the Activate gzip compression (mod_deflate).

Activating compression via php.ini

Alternatively, if you're using PHP you can also activate compression via php.ini. Add the following code to a php.ini file and upload it to your website folder.

zlib.output_compression=1
zlib.output_compression_level=9

The php.ini instructions apply only to the directory where the php.ini file is located. It is best to copy the file to all the directories where PHP files are located.

Further information is available in the Changing php Settings via php.ini article.