Gzip is used for compressing your text files including text, html, php, js and css. There is no need to gzip images for they are already compressed and gzipping them will cause extra server work.
Speed up site with Gzip & PHP

Use the following code at the top of your php files to gzip your page.

Place this at the top of your htaccess file. BE SURE TO REPLACE EXAMPLE.COM WITH YOUR DOMAIN ON LINE 2 & 3:

<?php
ob_start(“ob_gzhandler”);
?>

Speed up site with Gzip & Htaccess

Use the following code in your Htaccess file: (linux and unix servers ONLY)

#Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
#End Gzip

Leave a Comment