我正在使用Apache压缩呈现HTML文件,但它不工作。 为什么? 我是usmon hostmonster服务器和YII PHP框架。
的.htaccess:
<IfModule deflate_module> AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/json application/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 # Do NOT compress localhost #SetEnvIf Remote_Host 127.0.0.1 no-gzip # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary </IfModule>
我相信这是mod_deflate 。 不deflate_module 。
<IfModule mod_deflate>
注意:它看起来像是从文档中获取代码。 如文档所述, 除非您完全理解所有的configuration细节,否则不要使用它。 因此,也许只是从AddOutputFilterByType开始并从那里展开。