From 0b130abe224b06401d17f2ff213826b3430d2b34 Mon Sep 17 00:00:00 2001 From: Olga Matviienko <omatviienko@ebay.com> Date: Fri, 23 Jan 2015 11:55:50 +0200 Subject: [PATCH] MAGETWO-31196: ETag support on frontend, expiration/lifetime management --- .htaccess | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/.htaccess b/.htaccess index f1ef8719ba1..9d55781c377 100644 --- a/.htaccess +++ b/.htaccess @@ -166,7 +166,53 @@ ## Add default Expires header ## http://developer.yahoo.com/performance/rules.html#expires - ExpiresDefault "access plus 1 year" + <FilesMatch .*\.(ico|jpg|jpeg|png|gif|svg|js|css|swf|ttf|otf|woff|woff2|ogg|mp4|webm)$> + Header append Cache-Control private + </FilesMatch> + + ExpiresActive On + + <FilesMatch \.(html|xhtml|xml|shtml|phtml|php|txt)$> + ExpiresDefault "access plus 0 seconds" + </FilesMatch> + + ExpiresByType text/html "access plus 0 seconds" + + # Data + ExpiresByType text/xml "access plus 0 seconds" + ExpiresByType application/xml "access plus 0 seconds" + ExpiresByType application/json "access plus 0 seconds" + + # MFavicon, images, video, audio + <FilesMatch \.(ico|gif|png|jpg|jpeg|ogg|mp4|mkv|flv|swf|wmv|asf|asx|wma|wax|wmx|wm)$> + ExpiresDefault "access plus 1 year" + </FilesMatch> + ExpiresByType image/gif "access plus 1 year" + ExpiresByType image/png "access plus 1 year" + ExpiresByType image/jpg "access plus 1 year" + ExpiresByType image/jpeg "access plus 1 year" + ExpiresByType image/svg "access plus 1 year" + ExpiresByType video/ogg "access plus 1 year" + ExpiresByType audio/ogg "access plus 1 year" + ExpiresByType video/mp4 "access plus 1 year" + ExpiresByType video/webm "access plus 1 year" + + # Fonts + <FilesMatch \.(eot|ttf|otf|svg|woff|woff2)$> + ExpiresDefault "access plus 1 year" + </FilesMatch> + ExpiresByType application/x-font-ttf "access plus 1 year" + ExpiresByType font/opentype "access plus 1 year" + ExpiresByType application/x-font-woff "access plus 1 year" + ExpiresByType image/svg+xml "access plus 1 year" + ExpiresByType application/vnd.ms-fontobject "access plus 1 year" + + # CSS, JavaScript + <FilesMatch \.(css|js)$> + ExpiresDefault "access plus 1 year" + </FilesMatch> + ExpiresByType text/css "access plus 1 year" + ExpiresByType application/javascript "access plus 1 year" </IfModule> @@ -188,3 +234,4 @@ ## http://developer.yahoo.com/performance/rules.html#etags #FileETag none + #FileETag MTime Size -- GitLab