2012-12-18 27 views
0

我刚刚上传到网站的虚拟主机(它使用的cPanel),我使用样板 .htaccess文件(不变) - 这样的mod_deflate模块应该是工作,但它不是(我在http://www.whatsmyip.org/http-compression-test/(地址是okcpirot.rs))检查了这个。 我对这件事很陌生 - 有什么我需要打开在CPanel为了这个工作或它应该自动工作?样板的.htaccess mod_deflate模块不能正常工作

代码mod_deflate模块

<IfModule mod_deflate.c> 

    # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/ 
    <IfModule mod_setenvif.c> 
    <IfModule mod_headers.c> 
     SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding 
     RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding 
    </IfModule> 
    </IfModule> 

    # Compress all output labeled with one of the following MIME-types 
    <IfModule mod_filter.c> 
    AddOutputFilterByType DEFLATE application/atom+xml \ 
            application/javascript \ 
            application/json \ 
            application/rss+xml \ 
            application/vnd.ms-fontobject \ 
            application/x-font-ttf \ 
            application/xhtml+xml \ 
            application/xml \ 
            font/opentype \ 
            image/svg+xml \ 
            image/x-icon \ 
            text/css \ 
            text/html \ 
            text/plain \ 
            text/x-component \ 
            text/xml 
    </IfModule> 

</IfModule> 

回答

2

这可能是因为没有安装mod_deflate.c或已被禁用。如您所见,脚本首先检查是否安装了mod_deflate.c(<IfModule mod_deflate.c>)。这可能并非如此。

最好的办法是询问你的主机提供商是否可以启用它。