javascript - 如何恢复 GZIP 压缩?

标签 javascript .htaccess

我在 .htaccess 文件中添加了几行来压缩文件并提高网站速度。

但是之后,一些 JavaScript 就无法正常工作了。所以我从 .htaccess 文件中删除了这些行....

直到这些 javascript 出现问题......

如何恢复状态?

.htaccess 中添加并随后删除的代码:

# compress text, HTML, JavaScript, CSS, and 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 

最佳答案

您可以使用RemoveOutputFilter指令。

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

关于javascript - 如何恢复 GZIP 压缩?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32717374/

相关文章:

javascript - 在 $.ajax 成功后执行一个函数,而不是直接将其放入回调中

javascript - 如何使用jquery绑定(bind)禁用按钮中的点击功能?

c# - JavaScript DI/IoC 等效于静态类型语言的标准 DI 模式

php - GET参数无法使用php检索

apache - 使用 .htaccess 甚至对经过身份验证的用户隐藏文件

php - 将 404 重定向到类似的 url

apache - htaccess文件以某种方式被缓存?

javascript - 使用 Javascript 在 li 中创建 span 元素

javascript - 在 ngAutocomplete (Angular) 中选择项目时自动提交表单

regex - WordPress 重定向插件在目标 URL 中包含查询参数