From 3ef4faacbb459b18f2b11b6322debc3f48a54278 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Mon, 3 Oct 2022 14:14:32 +0100 Subject: [PATCH] Issue #1040534 by catch, Owen Barton, danreb, mikeytown2, ogi, omega8cc, xjm: Rewrite rules for gzipped CSS and JavaScript aggregates cause lots of lstats for files that will never exist (cherry picked from commit a6c49dbae4b77f9dcc2d06aad91efe825e16d295) --- .htaccess | 4 ++-- core/assets/scaffold/files/htaccess | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.htaccess b/.htaccess index 3f391852627..28f04c56f53 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 $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 $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 3f391852627..28f04c56f53 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 $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 $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]