Jump to content

Gzip html, css, js


$php_mysql$

Recommended Posts

hey all now im new to gzip got not much knowledge on it. i was testing my site in seositecheckup and according to the test im asked to compress my html, css and js files and i found this bit of coding on google

 

<?php
if(isset($_SERVER['HTTP_ACCEPT_ENCODING']) && 

substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'))
ob_start('ob_gzhandler');
else
ob_start();
?>

 

i included this file on top of my pages and then it seemed to compress my my file but it seem we need to set header expire on gzip so how could i set expire on it and could someone tell me what exactly is this coding above compressing i mean is it compressing image and all type of files?

Link to comment
Share on other sites

There is no reason for you to be doing this in php code.  Apache has a module (mod_deflate) that handles gzipping things on the fly.  There are probably scores of howtos and docs on this, but here's a decent one:  http://www.justinbritten.com/work/2008/12/apache-gzip-configuration/

 

You do not want to gzip images -- they already have compression in them. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.