Compressing Websites for Faster Processing using Gzip

It has recently come to peoples attention that Google is a big fan of website compression. By zipping and unzipping your website on the fly it will serve two purposes. Your web pages will download much faster to peoples computers plus it will lower the bandwidth usage over the internet.

Google now supports compression as a way to boost your website’s listings on their websites. If you have to identical sites and one uses compression and the other does not Google will rate the one that does higher in their rankings. The below video from Google points this out:

The following steps below will show you step by step on how to login in to Cpanel and input the correct code so all pages on your site will be Gzip compatible. First I will give you the following codes you will need.

Code if you have a .htm or .html based website:

Using .htaccess File

If you are going to put it in the .htaccess file (doesn’t work on all servers) enter the following as is at the very top:

# compress text, html, javascript, css, xml:
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

Now this method has not been working for many people (me included) so your second option is to use it in Cpanel. Login to Cpanel and scroll to the bottom of the page, there under Software/Services you will see an Optimize Website tab.

Cpanel Dashboard

Click on that and it will take you to the next screen where you will click on the bottom button that says Compress the specified MIME types
Cpanel Dashboard
and enter the complete code below in that text line. You may have to enter the code one line at a time but remember to leave a space between each line.

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

If you think it looks similar to the one above it is, the only difference is I took out the first line of the .htaccess code. You may check to see if the above code works on all your pages by visiting the following site: Online Gzip Test.

PHP Based Websites including WordPress and .htm, .html files that have PHP processing activated

You will still input the previous code in cpanel and do the following:

  1. If you have a WordPress based website all you need to do is download and install the following plugin: EZGZ from James Socol.
  2. If your website was created with other software what you will need to do is put the following code above the <header> tag on every php based webpage, I do mean above every webpage on your site.
    <!–?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], ‘gzip’)) ob_start(“ob_gzhandler”); else ob_start(); ?–>

Some website building software out there will make this an easy task, especially if you use XSitePro software from Intellimon and others. If you don’t want to use WordPress (which is my favorite) do yourself a favor and use
XSitePro instead.

That’s it, your websites are now Gzip enabled. If you don’t see the Optimize Website tab in Cpanel please contact your host to have it activated. I know if you host your website with BlueHost, it will be activated.

The following videos below will show you how to install the code in:

This entry was posted in Compressing Website for SEO. Bookmark the permalink.
Post comment as twitter logo facebook logo
Sort: Newest | Oldest
cna training online 6 pts

Thanks for information. Gzip is great.

fergusonsarah 101 pts

Thanks for sharing this codes.. I've been wondering for this.. Excellent work!