hostgnome

How to enable gzip in cPanel

You are here:
< All Topics

Enabling gzip can be done with a few simple steps

 

Log into cPanel and go to Optimize Website > Compress All Content

 

 

Then Modify your .htaccess file in File Manager > public_html. If you do not see .htaccess click top right “Settings” and enable “Show Hidden Files (dotfiles)”

 

Add the following to .htaccess

 

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE image/jpeg
AddOutputFilterByType DEFLATE image/png
AddOutputFilterByType DEFLATE image/gif
AddOutputFilterByType DEFLATE image/bmp
AddOutputFilterByType DEFLATE image/jpeg,
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE audio/mpeg
AddOutputFilterByType DEFLATE audio/*
AddOutputFilterByType DEFLATE video/mp4
</IfModule>

 

Next you will need to change the PHP version from our default native version. In cPanel navigate to PHP Selector¬†change to another version and click “Set as current

 

 

The final step is to enable zlib.output_compression. Go to MultiPHP INI Editor inside cPanel, select your domain/s, enable zlib.output_compression and click apply.

 

 

That’s it, you’re all done! Now test that it’s working on http://www.whatsmyip.org/http-compression-test/

Table of Contents