Forum Moderators: phranque
SetEnvIf Accept-Encoding ^[-*]?$ noencoding
SetEnvIf Accept-Encoding ^gzip$ gzip_only
SetEnvIf Accept-Encoding ^identity$ identity_only
with, however, a great many holes punched (notably Applebot, but also most mobiles, because many of my rules date back to 2015). <IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} \.(html?|php|cgi|js|css|xml|json|txt|svg)$ [NC]
RewriteCond %{HTTP:Accept-Encoding} ^$ [OR]
RewriteCond %{HTTP:Accept-Encoding} !gzip [OR]
RewriteCond %{HTTP:Accept-Encoding} !deflate
RewriteRule .* - [F]
</IfModule> RewriteRule (^|\.html|/)$ - [F]
i.e. “only evaluate the Conditions if the request is for a page”. Although Conditions are physically placed before the Rule, they are evaluated after--if at all.