| 
       
	使用这个功能的前提是:magento网站所在主机支持gzip压缩! 
	另外Magento 本身根目录自带的.htaccess 就有写入开启gzip压缩 的代码,只是被注释了,我们只需要把相关的注释去掉,下面,跟我一起&……*&* 
	对magento根目录的.htaccess 操作: 
	搜索output_compression ,把#php_flag zlib.output_compression on这行的#去掉。 
	搜索SetOutputFilter ,找到相关的是 
	
    # Insert filter on all content
    ###SetOutputFilter DEFLATE
    # Insert filter on selected content types only
    #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
    # Netscape 4.x has some problems...
    #BrowserMatch ^Mozilla/4 gzip-only-text/html
    # Netscape 4.06-4.08 have some more problems
    #BrowserMatch ^Mozilla/4\.0[678] no-gzip
    # MSIE masquerades as 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-gzip dont-vary
    # Make sure proxies don't deliver the wrong content
    #Header append Vary User-Agent env=!dont-vary
 
	处理后的代码是: 
	
    # Insert filter on all content
    SetOutputFilter DEFLATE
    # Insert filter on selected content types only
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    # MSIE masquerades as 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-gzip dont-vary
    # Make sure proxies don't deliver the wrong content
    Header append Vary User-Agent env=!dont-vary
 
	保存,把Magento缓存清掉刷新测试。。 
	果然,Magento利用.Htaccess开启gzip还是有点效果的... 
      
      (责任编辑:最模板) |