我想为某些页面禁用 GZip。我有这个.htaccess,但在访问时它仍然打开 GZip ( Content-Encoding: gzip) dashboard/index。
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI /dashboard/index no-gzip dont-vary
我试图添加Header set MyHeader %{REQUEST_URI}以查看是什么Request_URI,但它给出了内部服务器错误。
我还尝试了正则表达式dashboard/index, dashboard/index.*,"/dashboard/index"等,并尝试了SetEnvIfNoCase REQUEST_URI ...,但 GZip 仍在运行。
如果我发表评论#AddOutputFilterByType,则 GZip 将被关闭。
我正在使用 Apache 2.4.16、Yii 2.0.7、PHP。我在生产中使用 FPM,所以apache_setenv()不可用。