Adding gzip compression to your webpages.
Posted: Apr 24, 06, 15:30 techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Location: East Coast, West Coast? I know it's one of them.
You can compare using this tool the relative sizes of your site's pages if they are currently non-gzipped versus what they would be with gzip compression levels 1-9.
Note: it is not recommended to use any level above 2 or 3 due the increased server overhead. There is very little gain between > 3, actually > 2 is pretty much pointless and will just make your server work extra hard for very little drop in file size.
You can add this code to either your .htaccess file or Apache httpd.conf to enable gzip compression:
:: Code ::php_flag zlib.output_compression On
php_value zlib.output_compression_level 2
At 2, it will drop the overall page size down to about 25% of what it was to begin with, which will really help your dialup users.
Downside? If your pages are really bloated with html, say > 10 kB gzipped, the visitor won't see anything for 2-4 seconds on dialup, which is not a good situation.
The solution is to cut page HTML size down to about 5 kB gzipped, which an average dialup user will see fully laid out in about 1 second.
Yet another argument for clean code and css library files for styling.
Back to top
All times are GMT - 8 Hours