Skip to content

Instantly share code, notes, and snippets.

@mandrasch
Last active January 10, 2026 20:21
Show Gist options
  • Select an option

  • Save mandrasch/47914b2927fbb288efa793a603ce7816 to your computer and use it in GitHub Desktop.

Select an option

Save mandrasch/47914b2927fbb288efa793a603ce7816 to your computer and use it in GitHub Desktop.
Apache .htaccess for fully static SvelteKit projects (SSG)
<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