Some web browsers always request websites in a compressed format. If your site is capable of being delivered compressed not only does it reduce your bandwidth usage, it can also reduce load time for your users (which is always a good thing!). Want to know if your website is already being compressed? You can use this online HTML compression check to see.
There are several methods to compressing your websites. Each host has different methods enabled or disabled so always check with your host (sometimes their knowledgebase will have specifics) as to which method will work on their servers.
Apache users with GZIP enabled on their servers can add the following to their .htaccess file.
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
# remove browser bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0 no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
If Mod_DEFLATE is enabled on your server (again, check with your host! these could cause errors on your sites if the processes are not enabled). Add the following to your .htaccess file.
# DEFLATE by type - html, text, css, xml
AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml
# DEFLATE by extension
AddOutputFilter DEFLATE js css htm html xml
When you’re all done, be sure to check again. See if you’re compressed. Sometimes you can compress more than 75% of your uncompressed page size! Every MB counts.