.htaccess 测试gzip是否在本地工作
我有一个本地wamp设置,并在apache中安装了deflate_模块 我还在.htaccess中设置了以下规则.htaccess 测试gzip是否在本地工作,.htaccess,gzip,wamp,compression,.htaccess,Gzip,Wamp,Compression,我有一个本地wamp设置,并在apache中安装了deflate_模块 我还在.htaccess中设置了以下规则 <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript application/javascript application/json </I
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript application/javascript application/json
</IfModule>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript application/javascript application/json
但是我如何测试它是否工作——我如何判断文件是否正在被gzip压缩
谢谢 使用netcat并发送一个
接受编码:gzip,deflate
。如果返回了压缩的mumbo jumbo,那么您的文件将被gzip压缩
例如:
GET / HTTP/1.1
Host: www.yourdomain.org
Accept: text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,image/jpeg,image/gif
Accept-Language: en-us,en
Accept-Encoding: gzip,deflate
Connection: close
不要忘记在末尾添加两个换行符。我还建议使用
命令是:
curl--head--compressed
将打印网页请求的标题。找一行写着:
内容编码:gzip
。如果它不在那里,那么您就没有正确地配置它。实际上-您不能只在响应头中查看“Content Encoding:gzip”吗?例如,使用Firefox的Firebug。如果这对您有效,那么我更喜欢netcat方法,因为我的大部分工作都是在控制台中完成的,而且我有类似的脚本。