开发者

Enable GZip compression on serving files

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜