Joomla Gzip Page Compression

This tutorial will show you how to enable Joomla Gzip page compression and also show you how to enable file compression using the .htaccess file for Apache

Why should you enable Joomla page and file compression

Both Joomla page and website gzip file compression can reduce the overall page size and the size of the HTML, PHP, CSS and Javascript files by up to 30%.

Enabling gzip compression is great for improving the over all website and page speed because your visitors will need to download much smaller compressed pages and website files which in turn will make your website load much faster.

How do I enable Joomla page compression

Login into the Joomla administrator area of your website

Select the system menu / Global configuration menu and the server tab

Set the Gzip page compression to Yes and save the changes.

Joomla will now compress the output of all the pages generated by the website.

However we also recommend you compress all the HTML, PHP, CSS and Javascript files using .htaccess

Enable Gzip compression using the .htaccess file for Apache

You can use two different Apache modules to enable HTTP Gzip compression including mod_gzip and mod_deflate.

Both methods will provide you with the same compression level. However we would recommend you use the mod_deflate method as this is more widely supported by hosting companies compared to mod_gzip. For this tutorial we will be using mod_deflate.

Step 1 : Rename the Joomla htaccess.txt to .htaccess

Before you enable the Gzip compression you need to rename the default Joomla htaccess.txt file to .htaccess file

To rename the the default Joomla htaccess.txt file to .htaccess complete the following steps.

  1. Open your FTP software and browse to the directory where you have installed Joomla.
  2. You will now see a file htaccess.txt
  3. All you need to do is rename the file from htaccess.txt to .htaccess as shown in the screen shot below.

Step 2 : Add mod_deflate rules to the .htaccess file

The next step is to download and open the .htaccess file on your computer using a text editor like notepad.exe

Once you have opened the .htaccess file copy and past the following code at the bottom of the .htaccess file

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/opentype
# For Olders Browsers Which Can’t Handle Compression
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>

After you have copied and pasted the code to the bottom of the .httacces file you need to save the changes to the file and upload the file to your web hosting space where Joomla is installed.

Step 3 : Test Gzip Compression is enabled

The final thing you need to do is test if Gzip compression is enabled on your website.

You can complete a quick test by visiting https://checkgzipcompression.com/