# Winzerveedel Parking Survey: static SPA hosting on Apache (Hetzner Webhosting)

# The app's HTML page is _shell.html (built by TanStack Start SPA mode).
DirectoryIndex _shell.html

# Bookkeeping file written by the GitHub deploy; not for visitors.
<IfModule mod_authz_core.c>
  <Files ".ftp-deploy-sync-state.json">
    Require all denied
  </Files>
</IfModule>

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Always use HTTPS (enable SSL for the subdomain in konsoleH first).
  RewriteCond %{HTTPS} !=on
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  # Real files (JS, CSS, icons) are served as-is.
  RewriteCond %{REQUEST_FILENAME} -f
  RewriteRule ^ - [L]

  # A missing build file is a real 404, not the app page.
  RewriteRule ^assets/ - [L]

  # Everything else (e.g. a refresh on any app URL) gets the app page.
  RewriteRule ^ _shell.html [L]
</IfModule>

<IfModule mod_headers.c>
  # Hashed build files never change: let phones cache them for a year.
  <FilesMatch "\.(js|css)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
  # Images (logo, background, icons): cache for a week.
  <FilesMatch "\.(jpg|jpeg|png|webp)$">
    Header set Cache-Control "public, max-age=604800"
  </FilesMatch>
  # The page itself must always be re-checked, so updates reach phones.
  <FilesMatch "^(_shell\.html|manifest\.json)$">
    Header set Cache-Control "no-cache"
  </FilesMatch>
</IfModule>
