gpt4 book ai didi

apache 压缩 压缩 .js 和 .css 文件未压缩?

转载 作者:行者123 更新时间:2023-12-03 11:23:26 27 4
gpt4 key购买 nike

在 Apache Im 中,通过将以下内容添加到我的 .htaccess 文件来启用输出压缩:

# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

# Or, compress certain file types by extension:
<Files *.html>
SetOutputFilter DEFLATE
</Files>

因此,我使用 Content-Encoding: gzip 提供所有内容,但是当我使用 Yslow 测试我的网页时,我收到:
Grade D on Compress components with gzip

There are 3 plain text components that should be sent compressed

* http://mysite.com/javascript/youTubeEmbed/youTubeEmbed-jquery-1.0.css
* http://mysite.com/javascript/jquery.swfobject.1-1-1.min.js
* http://mysite.com/javascript/youTubeEmbed/youTubeEmbed-jquery-1.0.js

问题出在哪里?不应该自动压缩吗??

谢谢

卢卡

最佳答案

您是否记得在重新加载页面并运行 Yslow 之前清除缓存?

我遇到了完全相同的问题并像这样修复了它。这是我的代码:

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

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

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com