如何解决呢?其实很多的主机都已经默认安装一个组件:GZIP。我们就是要通过修改它来提高MAGENTO的运行速度。
现在我们为MAGENTO开启GZIP。比较方便的方法是修改根目录下.htaccess 文件。我们只需要去掉一些注释就可以了。
在根目录.htaccess找到和以下代码相似的代码,并且把代码修改得和下面一模一样。(去掉前面的#符号。)
############################################
## enable apache served files compression
##http://developer.yahoo.com/performance/rules.html#gzip
# Insertfilter
SetOutputFilter DEFLATE
# Netscape 4.x hassome problems…
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4.0[678] no-gzip
# MSIE masqueradesas Netscape, but it is fine
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
# Don’t compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzipdont-vary
# Make sure proxiesdon’t deliver the wrong content
Header append Vary User-Agent env=!dont-vary
另外还有下面这一段:
############################################
## enable resulting html compression
php_flagzlib.output_compression on