How to enable gzip compression for a single website in apache

The mod_deflate module provides the DEFLATE output filter that allows the output from your server to be compressed before being sent to the client over the network. mod_deflate is the replacement of mod_gzip which was used with an older version of Apache.

By default, mod_deflate module is enabled in Apache. To make sure that it is enabled, check following line in Apache configuration file.

LoadModule deflate_module modules/mod_deflate.so

Then open the .htaccess file of the domain and save the following content.

<IfModule mod_deflate.c>
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
</IfModule>

 

That's all...

 

Leave a Reply

Your email address will not be published. Required fields are marked *