From 882b5129b9f8d476c49cccc2a6df9866c7f2c732 Mon Sep 17 00:00:00 2001 From: Jay Trees Date: Mon, 7 Mar 2022 16:09:44 +0100 Subject: [PATCH] Improve caching --- .htaccess | 61 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/.htaccess b/.htaccess index fda503d4..bed7f119 100644 --- a/.htaccess +++ b/.htaccess @@ -17,12 +17,61 @@ RewriteRule ^([a-z\-]+)$ /?page=$1 [QSA,L] -# -# Headers -# +##-- When caching of gzipped JS and CSS files is used, enable this setting - # 1 Year - - Header set Cache-Control "public, max-age=31536000, no-transform" + Header set Vary Accept-Encoding + + +##-- Enable the compression for any type of content + + + SetOutputFilter DEFLATE + +##-- Customization of HTTP request and response headers + + + Header set Cache-Control "max-age=2592000, public, must-revalidate" + + + Header set Cache-Control "max-age=2592000, public, must-revalidate" + + + Header set Cache-Control "max-age=604800, private, must-revalidate" + + + Header set Cache-Control "max-age=604800, public, must-revalidate" + + + Header set Cache-Control "max-age=1, private, must-revalidate" + + + +##-- Generation of Expires and Cache-Control HTTP headers + + ExpiresActive On + ExpiresDefault "access plus 1 seconds" + ExpiresByType image/gif "access plus 2592000 seconds" + ExpiresByType image/jpg "access plus 2592000 seconds" + ExpiresByType image/jpeg "access plus 2592000 seconds" + ExpiresByType image/png "access plus 2592000 seconds" + ExpiresByType image/svg+xml "access plus 2592000 seconds" + ExpiresByType text/html "access plus 1 seconds" + ExpiresByType text/css "access plus 604800 seconds" + ExpiresByType text/javascript "access plus 604800 seconds" + ExpiresByType application/x-javascript "access plus 604800 seconds" + ExpiresByType application/javascript "access plus 604800 seconds" + ExpiresByType text/x-component "access plus 604800 seconds" + ExpiresByType font/truetype "access plus 604800 seconds" + ExpiresByType font/opentype "access plus 604800 seconds" + ExpiresByType application/x-font-ttf "access plus 604800 seconds" + ExpiresByType application/x-font-woff "access plus 604800 seconds" + ExpiresByType application/font-woff "access plus 604800 seconds" + ExpiresByType application/vnd.ms-fontobject "access plus 604800 seconds" + ExpiresByType image/x-icon "access plus 604800 seconds" + + + Header append Cache-Control "public" + +