Categories
技术讨论

在WordPress2.5中启用GZip

WordPress 2.5有很多不错的特性,前两天也把Hamo’s World 手动升级到WordPress2.5,不过发现WordPress中的GZip选项已经被取消了。调查后得知,现在WordPress已经不再采用php的zlib来进行压缩,而是把这项工作完全交由服务器来控制。如果服务器支持DEFLATE,则直接启用gzip,而且比PHP的压缩的效率要高。

但是和以前版本一样,对于css等静态页面,需要手动在.htaccess中设置。

<ifmodule mod_deflate.c>

AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-httpd-php application/x-javascript

</ifmodule>

如果服务器是Apache1.x,则需要采用以前WordPress中采用ob_gzhandler的方法或者使用GZIP Pages等插件。

查看页面是否已经启用gzip压缩,可以在GIDZipTest检测。

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.