There was a problem loading the comments.

How do I enable gzip (DEFLATE) compression on my website?

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
You can enable this for any website (home-made, WordPress, Joomla, etc.) with gzip using the Apache module mod_deflate.

To do this, you first need to create a file in your public_html directory called ".htaccess" or edit your existing .htaccess file.

The .htaccess file is a configuration file in which you can configure many things, of which compression is just one.

If you want most things to be compressed, you can just add the following to your .htaccess file:

AddOutputFilter DEFLATE text/html text/css text/plain application/xml application/javascript application/json application/rss+xml application/atom+xml text/javascript

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
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

The full documentation on using this mod_deflate can be found here

Alternatively, in a PHP based website you can implement gzip compression of the PHP output in the PHP code itself.

This is done using ob_gzhandler which is done as part of the ob_start function. The full documentation on this can be found
here

Share via
Did you find this article useful?  

Related Articles

© Eco Web Hosting