diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..fd53893 --- /dev/null +++ b/.htaccess @@ -0,0 +1,60 @@ +# Enable GZIP Compression + + AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript + AddOutputFilterByType DEFLATE application/javascript application/x-javascript application/json + AddOutputFilterByType DEFLATE application/xml application/xhtml+xml + AddOutputFilterByType DEFLATE image/svg+xml + AddOutputFilterByType DEFLATE font/woff font/woff2 application/font-woff application/font-woff2 + + +# Browser Caching - Static Assets + + ExpiresActive On + + # Images (1 year) + ExpiresByType image/jpeg "access plus 1 year" + ExpiresByType image/png "access plus 1 year" + ExpiresByType image/gif "access plus 1 year" + ExpiresByType image/webp "access plus 1 year" + ExpiresByType image/svg+xml "access plus 1 year" + ExpiresByType image/x-icon "access plus 1 year" + + # Fonts (1 year) + ExpiresByType font/woff "access plus 1 year" + ExpiresByType font/woff2 "access plus 1 year" + ExpiresByType application/font-woff "access plus 1 year" + ExpiresByType application/font-woff2 "access plus 1 year" + ExpiresByType font/ttf "access plus 1 year" + ExpiresByType font/otf "access plus 1 year" + + # CSS & JavaScript (1 month) + ExpiresByType text/css "access plus 1 month" + ExpiresByType application/javascript "access plus 1 month" + ExpiresByType text/javascript "access plus 1 month" + + # HTML (1 hour) + ExpiresByType text/html "access plus 1 hour" + + +# Cache-Control Headers + + # CSS & JS - 1 month + + Header set Cache-Control "public, max-age=2592000, immutable" + + + # Images - 1 year + + Header set Cache-Control "public, max-age=31536000, immutable" + + + # Fonts - 1 year + + Header set Cache-Control "public, max-age=31536000, immutable" + + + # HTML - no-cache (always check for updates) + + Header set Cache-Control "public, max-age=3600, must-revalidate" + +