April 18th, 2007
How to compress your HTML websites with PHP
You know bandwidth can cost a lot if you’re running a high bandwidth site. Other times you want to make your site as optimal in speed as you possibly can for the user to have a good experience when using your site.
Some sites have a lot of text and content and it helps a lot to compress that output in the long run it is just a better experience for the end users and healthier for the internet in general.
With PHP the easiest thing you can do after you have a website made, is to convert your HTML static site to PHP… You could simply rename it to .php in MOST cases but not all, and then add the following to the top of your file.
Add to the top of your PHP code:
<? ob_start(”ob_gzhandler”); ?>
Thats it! Simple as pie
You don’t have PHP on your website? Well *cough* blue chip hosting offers PHP for free to all members, we even have a free plan!
Have fun!
Compile Apache, PHP (With suhosin patch) + mod_perlAboutMake a button without an image editor using CSS!How to disable ugly HTML image borders in linksPoor man’s banner / ad rotator