Last active
January 10, 2026 20:21
-
-
Save mandrasch/47914b2927fbb288efa793a603ce7816 to your computer and use it in GitHub Desktop.
Apache .htaccess for fully static SvelteKit projects (SSG)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <IfModule mod_headers.c> | |
| # HTML | |
| # Cache: 0s (always revalidate) | |
| # Reason: entry point (.html files) changes on every deploy | |
| <FilesMatch "\.(html)$"> | |
| Header set Cache-Control "public, max-age=0, must-revalidate" | |
| </FilesMatch> | |
| # JS / CSS (hashed) | |
| # Cache: 24h | |
| # Reason: good performance, low failure risk (SvelteKit is | |
| # using hashed file names which differ on every build / deploy) | |
| <FilesMatch "\.(js|css)$"> | |
| Header set Cache-Control "public, max-age=86400" | |
| </FilesMatch> | |
| # Images / fonts | |
| # Cache: 7d | |
| # Reason: rarely change, safe moderate TTL | |
| <FilesMatch "\.(png|jpg|jpeg|svg|webp|woff2)$"> | |
| Header set Cache-Control "public, max-age=604800" | |
| </FilesMatch> | |
| </IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment