Reputation: 17530
Hiii,
I want to compress output [excluding image only] using GZIP in PHP, how to do so for each type of files [PHP, CSS, JS, HTML] ?
I know the code to work with PHP file only.
Upvotes: 0
Views: 636
Reputation: 503
Place this line in your page before any headers or other output.
ob_start("ob_gzhandler");
And for other files you can serve them through php, this could be used if you have mod-rewrite, but no mod-deflate or mod-gzip
Upvotes: 1
Reputation: 6092
Use mod_deflate module of Apache more info
http://httpd.apache.org/docs/2.0/mod/mod_deflate.html
http://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-compression/
Upvotes: 2