From 28b34d8198ea4dd81ef7d7ddfaeb488e81634e1c Mon Sep 17 00:00:00 2001 From: Jack Cherng Date: Tue, 25 Jun 2019 14:04:59 +0800 Subject: [PATCH] Apache prefers to brotli over gzip when possible Brotli is a better (than gzip) compression algorithm derived by Google. It's available in Apache 2.4.26 and later. https://en.wikipedia.org/wiki/Brotli https://httpd.apache.org/docs/2.4/mod/mod_brotli.html Signed-off-by: Jack Cherng --- .htaccess | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.htaccess b/.htaccess index 99296c0d3..5c2643b7b 100644 --- a/.htaccess +++ b/.htaccess @@ -19,6 +19,13 @@ RewriteRule /?(README.*|meta\.json|composer\..*|jsdeps.json)$ - [F] SetOutputFilter DEFLATE +# prefer to brotli over gzip if brotli is available + +SetOutputFilter BROTLI_COMPRESS +# some assets have been compressed, so no need to do it again +SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|web[pm]|woff2?)$ no-brotli + + ExpiresActive On ExpiresDefault "access plus 1 month"