apache - 压缩/压缩 javascript 和 css 文件

标签 apache gzip

将此添加到域的虚拟主机后

AddOutputFilterByType DEFLATE application/javascript text/javascript text/css

响应头不包含任何内容类型:gzip 或 deflate

这是 CSS 文件的响应头
Cache-Control max-age=29030400
Connection Keep-Alive
Date Sat, 06 Jun 2015 10:15:35 GMT
Etag "f0007e-46364-514a70ecd9000"
Expires Sat, 07 May 2016 10:15:35 GMT
Keep-Alive timeout=5, max=97
Server Apache
Vary Accept-Encoding

最佳答案

尝试这个

AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/css

并记得在重新加载页面之前清除缓存。

关于apache - 压缩/压缩 javascript 和 css 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30681631/

相关文章:

javascript - 用于 Javascript 的 Gzip/TAR 库

php - 返回预压缩的静态内容而不是动态压缩

.htaccess - 如果浏览器不支持 gzip 会怎样?

php - 无法在 Windows 7 XAMPP 上安装 gmagick

php - 无法连接到树莓派上的php和mysql

apache - 在 apache Web 服务器上使用 Node.js socket.io 推送通知

java - Reddit OAuth2 API 循环重定向

java - Apache http 服务器重写 url 失败

c# - 是否有任何(可逆)方式(在 c# 中)将字符串转换为更小的字符串,当我说更小时我的意思是 "with reduced length"?

c++ - 'zlib' 的 Uncompress() 返回 Z_DATA_ERROR