From eae531ec562d0f27615ffc1b0eaf34b5d250212f Mon Sep 17 00:00:00 2001 From: timur Date: Mon, 20 Nov 2017 19:12:36 +0200 Subject: [PATCH] gzip --- .htaccess | 52 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/.htaccess b/.htaccess index ce7ee7f..cbe72c6 100755 --- a/.htaccess +++ b/.htaccess @@ -43,13 +43,45 @@ AddDefaultCharset utf-8 RewriteRule \.(htaccess|htpasswd|svn|git) - [F] - - mod_gzip_on Yes - mod_gzip_dechunk Yes - mod_gzip_item_include file .(html?|txt|css|js|php|pl)$ - mod_gzip_item_include handler ^cgi-script$ - mod_gzip_item_include mime ^text/.* - mod_gzip_item_include mime ^application/x-javascript.* - mod_gzip_item_exclude mime ^image/.* - mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* - \ No newline at end of file + + # 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] + + # 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] + + + # Serve correct content types, and prevent mod_deflate double gzip. + RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-gzip:1] + RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1] + + + + # Serve correct encoding type. + Header append Content-Encoding gzip + + # Force proxies to cache gzipped & + # non-gzipped css/js files separately. + Header append Vary Accept-Encoding + + + + + # Turn on the module. + ExpiresActive on + # Set the default expiry times. + ExpiresDefault "access plus 2 days" + ExpiresByType image/jpg "access plus 1 month" + ExpiresByType image/gif "access plus 1 month" + ExpiresByType image/jpeg "access plus 1 month" + ExpiresByType image/png "access plus 1 month" + ExpiresByType image/ico "access plus 1 month" + ExpiresByType image/x-icon "access plus 1 month" + ExpiresByType text/html "access plus 600 seconds" + \ No newline at end of file -- libgit2 0.21.4