无法使 mod_deflate 工作

无法使 mod_deflate 工作

我似乎无法让 mod_deflate 工作。我尝试使用 httpd.conf 和 htaccess,但没有成功。这是我的 htaccess 代码:

# DEFLATE compression
<IfModule mod_deflate.c>
# Set compression for: html,txt,xml,js,css
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
# Deactivate compression for buggy browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
# Set header information for proxies
Header append Vary User-Agent
</IfModule>
# END DEFLATE

我检查了模块已经安装并配置好了,我还能做什么?

答案1

它错过了SetOutputFilter

# MOD_DEFLATE COMPRESSION
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript  application/x-httpd-php

# DEFLATE NOT COMPATIBLE BROWERS
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

相关内容