如何使用 .htaccess 从目录中删除 Brotli 压缩和 Gzip 压缩
我的托管计划是带有 OpenLiteSpeed 的 cPanel,而不是 Apache。我在 cPanel 中打开了“压缩所有内容”设置。这似乎在某些地方使用 gzip,在其他地方使用 brotli。现在我需要防止某些目录进行这种压缩。我的托管计划给出的 .htaccess 规则是:
RemoveOutputFilter DEFLATE html txt xml css js php
但是,当我访问该网站然后检查 Chrome Dev Tools > 时,网络并点击主页,我仍然看到 Content-Encoding: br,表明 Brotli 仍在使用。因此,在进行一些测试时,我尝试了以下方法,但它们也都失败了:
RemoveOutputFilter BROTLI_COMPRESS;DEFLATE html txt xml css js php
RemoveOutputFilter BROTLI_COMPRESS DEFLATE html txt xml css js php
# place the following as a second line under RemoveOutputFilter DEFLATE html txt xml css js php
RemoveOutputFilter BROTLI_COMPRESS html txt xml css js php
# place the following as a second line under RemoveOutputFilter DEFLATE html txt xml css js php
RemoveOutputFilter BROTLI html txt xml css js php
# place the following as a second line under RemoveOutputFilter DEFLATE html txt xml css js php
RemoveOutputFilter BR html txt xml css js php
How do I close all Compression on a给定目录使用 .htaccess?
My hosting plan is cPanel with OpenLiteSpeed instead of Apache. I turned on Compress All Content setting in cPanel. This appears to use gzip in some places, brotli in others. Now I need to prevent some directories from having this compression. The .htaccess rule I was given by my hosting plan was:
RemoveOutputFilter DEFLATE html txt xml css js php
However, when I visit the website and then check Chrome Dev Tools > Network and click on the homepage, I still see Content-Encoding: br, indicating Brotli is still engaged. So, doing some tests, I tried the following and they all fail too:
RemoveOutputFilter BROTLI_COMPRESS;DEFLATE html txt xml css js php
RemoveOutputFilter BROTLI_COMPRESS DEFLATE html txt xml css js php
# place the following as a second line under RemoveOutputFilter DEFLATE html txt xml css js php
RemoveOutputFilter BROTLI_COMPRESS html txt xml css js php
# place the following as a second line under RemoveOutputFilter DEFLATE html txt xml css js php
RemoveOutputFilter BROTLI html txt xml css js php
# place the following as a second line under RemoveOutputFilter DEFLATE html txt xml css js php
RemoveOutputFilter BR html txt xml css js php
How do I turn off all compression on a given directory using .htaccess?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您指的是 LiteSpeed Enterprise ,因为 OpenLiteSpeed 无法与 cPanel 一起使用,
尝试此
.htaccess
应该禁用 BR 和 GZIPI assume you mean the LiteSpeed Enterprise , as OpenLiteSpeed won't work with cPanel
try this to
.htaccess
should disable both BR and GZIP