Optimize Website Using Gzip Compression Download & Install

Free Premium SEO Tools Pack

Optimize Website Using Gzip Compression Download & Install

08/12/2016 7:30 AM by Admin in Tutorials

Gzip Compression Website

Website Gzip compression makes it promising to reduce the size of web pages and any other typical web files to about 30% or less of its original size before it gets sent to the visitor. This compressed file is then served to the browser of the visitor which decompresses it automatically where after the full file gets served to the visitor again. Enabling Gzip compression is great for refining page speed because the browser of your visitor will need to download much smaller web files as the unique ones when browsing your web pages. There’s no intention to not use it these days, every knowledgeable website owner should use it for his/her website(s).

Enable Gzip compression using the .htaccess file on Server

You can actually use two mods to enable HTTP gzip compression: mod_gzip or mod_deflate. Mod_gzip enables Gzip compression and mod_deflate makes it possible to compress the output from your server before it is being sent to your visitor (which is the same thing). So should you be compressing your resources with gzip or deflate? In the end it doesn't matter much, both modules will provide you with the same maximum Gzip compression possible. But, As a general rule it’s recommended using mod_deflate since it’s more extensively supported as mod_gzip. Mod_deflate is also better documented and is easier to configure. If mod_deflate doesn’t work on your server you can use mod_gzip. Not every host has these modules enabled, so make sure your host has one of them enabled. When you are sure your server has one of these mods enabled, continue by adding one of the below codes to your .htaccess file (which can be found or should be placed in your root folder):

To enable mod_deflate (recommended):

<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

You can download the above script in a .htaccess file here.
To enable mod_gzip (second back up choice):

<ifModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
  mod_gzip_item_exclude mime ^image/.* 
  mod_gzip_item_include handler ^cgi-script$

Download the above script in a .htaccess file here.

Extra note

If you just want to compress certain components or a definite file type with Gzip make sure you remove or include the file type to one of the above lists. And again, make sure at least one of these mods is enabled on the server where your website is hosted. Just copy & paste the associated above code and place it inside your .htaccess file. If you don’t want to compress a certain file type, just remove the associated file type from the code.

Gzip on Windows Servers (IIS Manager)

If your site is hosted on a Windows server you can enable compression for both static and dynamic files. It’s justly easy to set this up in IIS manager:
1. Open up IIS Manager
2. Click on the site you want to enable compression for
3. Find and click on Compression (under IIS)
4. Now Enable static compression and you are done!
If it’s not working out like you want it to, take a look at to Microsoft’s guide on this subject to learn how you can set it up correctly.

Enable Gzip in WordPress

Download this (click here) or any other plugin for WordPress and optimize your website’s speed.

I enabled Gzip so what?

Now that you have enabled Gzip on your website check your Google PageSpeed Insights here to see instant impact & result.

leave a comment
Please post your comments here.