开发者

Enable GZip compression on serving files

开发者 https://www.devze.com 2023-03-16 20:28 出处:网络
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] ?

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.


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/


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

0

精彩评论

暂无评论...
验证码 换一张
取 消