Posted on 28/5/06 by Felix Geisendörfer
Update: I just found a little issue with this technique inside CakePHP. Read more about this here: Issues with output buffering in CakePHP
Well, beeing on a 64 kbit connection (that's a long story ...) I've beeing bothered more then once by how long this blog took to load. So having played with gzip compression on other websites of mine like fg-webdesign.de in recent times, today I thought, why not do it with thinkingphp.org?
The results are quite astounding. The html of the initial start site was 125 kbyte before. Now putting in gzip compression it's just tiny 14 kbyte, 11,2% of the initial size! I think this is one of these 5 minute fixes that are worth more then hours of coding in certain projects ... ; ). Btw. the reason for the initial Html code to be that big is Geshi which outputs a lot of Html and CSS for syntax highlighting my PHP code I publish here.
Here is the code I just put on top of my header.php for my wordpress theme: (Nothing exiting, so)
header('Content-type: text/html; charset: UTF-8');
$offset = -1;
$ExpStr = "Expires: " .
gmdate('D, d M Y H:i:s',
time() + $offset) . ' GMT';
The page should now load around 9-10x as fast as it has before ; ).
You can skip to the end and add a comment.
This post is too old. We do not allow comments here anymore in order to fight spam. If you have real feedback or questions for the post, please contact us.