From 7f5e51d92be3e5a406c4d9a313235bc821c20ce8 Mon Sep 17 00:00:00 2001 From: Dave Long Date: Thu, 30 Mar 2023 15:03:35 +0100 Subject: [PATCH] Issue #3336463 by sleitner, recrit, catch: Htaccess rewrite rules for gzipped CSS and JavaScript aggregates never match (cherry picked from commit 1d3e0326a5af492e4c0946ab6c6bb5be6d4d5926) --- .htaccess | 4 ++-- core/assets/scaffold/files/htaccess | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.htaccess b/.htaccess index 116acf42fb3..0e0618a54fe 100644 --- a/.htaccess +++ b/.htaccess @@ -151,12 +151,12 @@ AddEncoding gzip svgz # Serve gzip compressed CSS files if they exist and the client accepts gzip. RewriteCond %{HTTP:Accept-encoding} gzip RewriteCond %{REQUEST_FILENAME}\.gz -s - RewriteRule ^(.*css_[a-zA-Z0-9-_])\.css$ $1\.css\.gz [QSA] + RewriteRule ^(.*css_[a-zA-Z0-9-_]+)\.css$ $1\.css\.gz [QSA] # Serve gzip compressed JS files if they exist and the client accepts gzip. RewriteCond %{HTTP:Accept-encoding} gzip RewriteCond %{REQUEST_FILENAME}\.gz -s - RewriteRule ^(.*js_[a-zA-Z0-9-_])\.js$ $1\.js\.gz [QSA] + RewriteRule ^(.*js_[a-zA-Z0-9-_]+)\.js$ $1\.js\.gz [QSA] # Serve correct content types, and prevent double compression. RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1,E=no-brotli:1] diff --git a/core/assets/scaffold/files/htaccess b/core/assets/scaffold/files/htaccess index 116acf42fb3..0e0618a54fe 100644 --- a/core/assets/scaffold/files/htaccess +++ b/core/assets/scaffold/files/htaccess @@ -151,12 +151,12 @@ AddEncoding gzip svgz # Serve gzip compressed CSS files if they exist and the client accepts gzip. RewriteCond %{HTTP:Accept-encoding} gzip RewriteCond %{REQUEST_FILENAME}\.gz -s - RewriteRule ^(.*css_[a-zA-Z0-9-_])\.css$ $1\.css\.gz [QSA] + RewriteRule ^(.*css_[a-zA-Z0-9-_]+)\.css$ $1\.css\.gz [QSA] # Serve gzip compressed JS files if they exist and the client accepts gzip. RewriteCond %{HTTP:Accept-encoding} gzip RewriteCond %{REQUEST_FILENAME}\.gz -s - RewriteRule ^(.*js_[a-zA-Z0-9-_])\.js$ $1\.js\.gz [QSA] + RewriteRule ^(.*js_[a-zA-Z0-9-_]+)\.js$ $1\.js\.gz [QSA] # Serve correct content types, and prevent double compression. RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1,E=no-brotli:1]