diff --git a/.htaccess b/.htaccess index 9d55781c37765187e53b0295891d6a57c2d66756..ebdf426004b97f28aed55b9b58487dfe423a079f 100644 --- a/.htaccess +++ b/.htaccess @@ -61,11 +61,63 @@ SecFilterScanPOST Off </IfModule> +############################################ +## setting MIME types + +# JavaScript +AddType application/javascript js jsonp +AddType application/json json + +# CSS +AddType text/css css + +# Images and icons +AddType image/x-icon ico +AddType image/gif gif +AddType image/png png +AddType image/jpeg jpg +AddType image/jpeg jpeg + +# SVG +AddType image/svg+xml svg + +# Fonts +AddType application/vnd.ms-fontobject eot +AddType application/x-font-ttf ttf +AddType application/x-font-otf otf +AddType application/x-font-woff woff +AddType application/font-woff2 woff2 + +# Flash +AddType application/x-shockwave-flash swf + +# Archives and exports +AddType application/zip gzip +AddType application/x-gzip gz gzip +AddType application/x-bzip2 bz2 +AddType text/csv csv +AddType application/xml xml + <IfModule mod_headers.c> ############################################ ## prevent clickjacking Header set X-Frame-Options SAMEORIGIN + + Header append Cache-Control no-cache + + <FilesMatch .*\.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|htm)$> + Header append Cache-Control public + </FilesMatch> + + <FilesMatch .*\.(zip|gz|gzip|bz2|csv|xml)$> + Header append Cache-Control no-store + </FilesMatch> + + <FilesMatch ".(html)$"> + Header append Vary: Accept-Encoding + </FilesMatch> + </IfModule> <IfModule mod_deflate.c> @@ -166,53 +218,46 @@ ## Add default Expires header ## http://developer.yahoo.com/performance/rules.html#expires - <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)$> + # Data + <FilesMatch \.(html|xhtml|shtml|phtml|php|txt|zip|gz|gzip|bz2|csv|xml)$> 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 text/csv "access plus 0 seconds" ExpiresByType application/json "access plus 0 seconds" + ExpiresByType application/zip "access plus 0 seconds" + ExpiresByType application/x-gzip "access plus 0 seconds" + ExpiresByType application/x-bzip2 "access plus 0 seconds" + + # 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" - # MFavicon, images, video, audio - <FilesMatch \.(ico|gif|png|jpg|jpeg|ogg|mp4|mkv|flv|swf|wmv|asf|asx|wma|wax|wmx|wm)$> + # Favicon, images, flash + <FilesMatch \.(ico|gif|png|jpg|jpeg|swf|svg)$> 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" + ExpiresByType image/svg+xml "access plus 1 year" # Fonts <FilesMatch \.(eot|ttf|otf|svg|woff|woff2)$> ExpiresDefault "access plus 1 year" </FilesMatch> + ExpiresByType application/vnd.ms-fontobject "access plus 1 year" ExpiresByType application/x-font-ttf "access plus 1 year" - ExpiresByType font/opentype "access plus 1 year" + ExpiresByType application/x-font-otf "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" + ExpiresByType application/font-woff2 "access plus 1 year" </IfModule> @@ -234,4 +279,3 @@ ## http://developer.yahoo.com/performance/rules.html#etags #FileETag none - #FileETag MTime Size