Apache 启用mod_deflate
我正在尝试启用mod_deflate。我有Apache 2.0+并在.htaccess文件中尝试了以下代码:Apache 启用mod_deflate,apache,Apache,我正在尝试启用mod_deflate。我有Apache 2.0+并在.htaccess文件中尝试了以下代码: AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css <FilesMatch "\\.(js|css|html|htm|php|xml)$"> SetOutputFilter DEFLATE </FilesMatch> AddOutputFilterByType DEFLATE
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
<FilesMatch "\\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
SetOutputFilter放气
当我在firebug中测试我的站点时,它没有压缩我的任何文件。我做错了什么?因为这将很快被转移到旧金山,不是吗:
<FilesMatch "\.(js|css|html|htm|php|xml)$">
否则正则表达式将变成\.js
,例如(因为您已转义了“\”)。
SetOutputFilter放气
我用了这个,它成功了。这是一个互联网历史问题。我的yahoo Yslow正在保存第一次检查的结果,因此当我修改htaccess时,差异没有显示出来。这是可行的,但由于某种原因,它忽略了我的所有js和css文件。我只保存了10kb:(如果将
text/javascript
添加到AddOutputFilterByType`行,会发生什么情况?这有帮助吗?不幸的是不是lol,它只压缩我的php文件,不压缩js或css。这可能是因为它们在根目录下吗?