1.9.2 : Enable Gzip compression to Optimize Website

What is Gzip compression ?

Gzip compression is a method of compressing files (making them smaller) for faster network transfers of file to load. It is also a file format. Gzip Compression allows your web server to provide smaller file sizes which makes your website to load faster for your website users and visitors.If you are not using it for some reason, your webpages are likely slower than your competitors.

  •  Here are the most common ways to enable compression including .htaccess, Apache, Nginx and litespeed Webservers

Enable compression via .htaccess

  1. Login into your cpanel
  2. Open to File Manager
  3. Go to path “public_html/www”
  4. The code below should be added to your .htaccess file

<IfModule mod_deflate.c>
<IfModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
<IfModule mod_mime.c>
# DEFLATE by extension
AddOutputFilter DEFLATE js css htm html xml


Enable compression on Apache webservers

These instructions and code above will work on Apache. If they are not working there is another way that may work for you. If the above code did not seem to work, remove it from your .htaccess file and try this one instead
# START GZIP COMPRESSION on Apache webservers
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
# END GZIP COMPRESSION on Apache webservers


Enable compression on NGINX webservers

To enable compression in NGINX you need to paste the following code to your config file

gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

# Disable for IE < 6 because there are some known problems
gzip_disable “MSIE [1-6].(?!.*SV1)”;

# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;


Enable compression on Litespeed web-servers

  • The ideal way to enable compression in Litespeed is to do it through the configuration under “tuning”.
  • Just go down to “enable compression” and check to see if it is on, if not click “edit” then choose to turn it on.
  • While you are there, look over the several Gzip options that are nearby.

Thank you i hope it useful to you.

Check Also


SEO Basic Quiz – 1

Leave a Reply

error: Content is protected !!