mod_expires to Deflate and Brotli in one file: a year for fingerprinted files, a day or a month for others, and revalidation for HTML.
# Needs: mod_expires, mod_headers, mod_setenvif, mod_deflate, mod_brotli;
# AllowOverride FileInfo Indexes
ExpiresActive On
ExpiresByType text/css "access plus 1 day"
ExpiresByType text/javascript "access plus 1 day"
ExpiresByType image/avif "access plus 1 month"
<FilesMatch "\.[0-9a-f]{8,}\.(css|js|mjs|woff2|avif|webp|svg)$">
ExpiresActive Off
Header set Cache-Control "public, max-age=31536000, immutable"
</FilesMatch>
<FilesMatch "\.(html|php)$">
Header set Cache-Control "no-cache"
</FilesMatch>
AddOutputFilterByType BROTLI_COMPRESS;DEFLATE text/html text/css text/javascript image/svg+xml
SetEnvIfNoCase Accept-Encoding "\bbr\b" no-gzipLines 3 to 6 and 8 need Indexes; line 8 drops the Expires that mod_expires would add beside the year. Offered a browser's gzip, deflate, br, zstd, Apache 129 chose gzip until line 15 switched mod_deflate off for Brotli clients:
/css/app.3f9a1c2e.css browser br 1052 public, max-age=31536000, immutable /css/app.3f9a1c2e.css gzip gzip 2801 public, max-age=31536000, immutable /css/print.css browser br 1052 max-age=86400 +Expires /index.html browser br 46 no-cache