|
| 1 | +<IfModule mod_expires.c> |
| 2 | + ExpiresActive On |
| 3 | + |
| 4 | + # Default |
| 5 | + ExpiresDefault "access plus 1 month" |
| 6 | + |
| 7 | + # HTML |
| 8 | + ExpiresByType text/html "access plus 0 seconds" |
| 9 | + |
| 10 | + # CSS & JS |
| 11 | + ExpiresByType text/css "access plus 1 year" |
| 12 | + ExpiresByType application/javascript "access plus 1 year" |
| 13 | + ExpiresByType text/javascript "access plus 1 year" |
| 14 | + |
| 15 | + # Images |
| 16 | + ExpiresByType image/webp "access plus 1 year" |
| 17 | + ExpiresByType image/jpeg "access plus 1 year" |
| 18 | + ExpiresByType image/png "access plus 1 year" |
| 19 | + ExpiresByType image/gif "access plus 1 year" |
| 20 | + ExpiresByType image/svg+xml "access plus 1 year" |
| 21 | + ExpiresByType image/x-icon "access plus 1 year" |
| 22 | + ExpiresByType image/vnd.microsoft.icon "access plus 1 year" |
| 23 | + |
| 24 | + # Fonts |
| 25 | + ExpiresByType font/ttf "access plus 1 year" |
| 26 | + ExpiresByType font/woff "access plus 1 year" |
| 27 | + ExpiresByType font/woff2 "access plus 1 year" |
| 28 | + ExpiresByType font/otf "access plus 1 year" |
| 29 | + ExpiresByType application/font-woff "access plus 1 year" |
| 30 | + ExpiresByType application/font-woff2 "access plus 1 year" |
| 31 | + ExpiresByType application/x-font-ttf "access plus 1 year" |
| 32 | + ExpiresByType application/x-font-woff "access plus 1 year" |
| 33 | + ExpiresByType application/vnd.ms-fontobject "access plus 1 year" |
| 34 | +</IfModule> |
| 35 | + |
| 36 | +<IfModule mod_headers.c> |
| 37 | + # Cache static assets for 1 year |
| 38 | + <FilesMatch "\.(ttf|woff|woff2|otf|eot|svg|webp|jpg|jpeg|png|gif|ico|css|js)$"> |
| 39 | + Header set Cache-Control "public, max-age=31536000, immutable" |
| 40 | + </FilesMatch> |
| 41 | + |
| 42 | + # No cache for HTML |
| 43 | + <FilesMatch "\.html$"> |
| 44 | + Header set Cache-Control "no-cache, no-store, must-revalidate" |
| 45 | + Header set Pragma "no-cache" |
| 46 | + Header set Expires 0 |
| 47 | + </FilesMatch> |
| 48 | +</IfModule> |
0 commit comments