Howdy,
Whenever someone visits your website, Apache (web server) sends the html, CSS, JavaScripts to the browser uncompressed. If you are running a successful website and get a lot of traffic and have to pay for Bandwidth, gZipping your data before sending it to the browser would be a good option.
Using mod_gzip compression which is an Apache web server module, or one of the other methods of gzip, your server will only send out gzipped content All the new browsers currently in use support gzip. Incase an old browser which doesnt support gZip makes a request, uncompressed HTML will be served.
gZip will work on the following file types: HTML, JS, CSS, JSON, XML
Some advantages of Zipping your data
To check if your site is sending gZipped content or not, use these links
http://whatsmyip.org/mod_gzip_test/
http://www.gidnetwork.com/tools/gzip-test.php
If your server is not sending gZipped data then you can write to your server/hosting company and ask them to enable mod_gzip on the server. You can also tell them the advantages of doing the same. Dreamhost/Mediatemple already has this module enabled. If you are running your own server please ask the system administrator to enable it for you.
More tips coming up soon.
Cheers
Sathya
December 13th, 2008 at 7:22 am
Hey I was reading on this couple of weeks ago thought I’ll implement this on my blog but forgot to do! Thanks!
Manan
February 18th, 2009 at 12:36 am
Oh this is a cool tip! had heard about gzip but never bothered to check what it is. Will check it out.
Saurabh
February 18th, 2009 at 12:06 pm
Hey Kunal you forgot to mention that we can even do a gzip-encoding using .htaccess also. So that people who have theire sites hosted on servers can use it:
# Compress some text file types
AddOutputFilterByType DEFLATE text/html text/css text/xml application/x-javascript
# Deactivate compression for buggy browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
yabate
April 18th, 2010 at 12:55 am
Thanks for useful information.
Now my data savings are
Original Size: 88.65 KB
Gzipped Size: 16.32 KB
Data Savings: 81.59%
Juzar
June 19th, 2010 at 10:15 pm
Hey dude, This is good info.
However, just want to share why I chose mod_deflate over mod_gzip :
1) mod_deflate is faster than mod_gzip since gzip compresses more (slightly). So on every request the webserver has to do that much processing extra.
2) You need to download and build and install mod_gzip where as mod_deflate.so comes with the standard apache installation.
That’s all.