# Explicitly grant access — fixes 403 Forbidden caused by a restrictive
# default/parent config on some shared hosts. Works on both Apache 2.4
# (mod_authz_core) and older Apache 2.2 style hosts.
<IfModule mod_authz_core.c>
  Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
  Order allow,deny
  Allow from all
</IfModule>

# Serve index.html automatically when the folder URL is opened directly
# (e.g. https://policy.fit/usnews  instead of  https://policy.fit/usnews/index.html)
DirectoryIndex index.html index.htm

# Some shared hosts need this too, in case DirectoryIndex alone isn't picked up
<IfModule mod_dir.c>
  DirectoryIndex index.html
</IfModule>

# Directory listing must stay off, but that should never itself cause a 403 —
# it just means "no listing", not "no access" — as long as index.html above
# is found and readable.
Options -Indexes +FollowSymLinks

# Correct MIME type for the PWA manifest (some Apache configs serve it wrong,
# which can silently break "Add to Home Screen")
<IfModule mod_mime.c>
  AddType application/manifest+json .json
</IfModule>

# Never let old cached HTML/service-worker hide fresh deploys
<IfModule mod_headers.c>
  <FilesMatch "\.(html)$">
    Header set Cache-Control "no-cache, must-revalidate"
  </FilesMatch>
  <FilesMatch "^sw\.js$">
    Header set Cache-Control "no-cache, must-revalidate"
  </FilesMatch>
</IfModule>
