# --- Salat al-Nariyaa PWA ---

# 1. Service worker must NOT be cached aggressively, or users won't get updates.
<Files "service-worker.js">
    Header set Cache-Control "no-cache, must-revalidate"
</Files>

# 2. The manifest also short-cache
<Files "manifest.json">
    Header set Cache-Control "no-cache, must-revalidate"
</Files>

# 3. Long cache for static assets (busted by service-worker version bump)
<FilesMatch "\.(css|js|png|jpg|jpeg|svg|woff2|woff|ttf)$">
    Header set Cache-Control "public, max-age=3600"
</FilesMatch>

# Correct MIME types for web fonts (some shared hosts don't have these by default)
AddType font/woff   .woff
AddType font/woff2  .woff2
AddType font/ttf    .ttf

# Service worker rules override the broader match above (.htaccess evaluates
# in order; specific Files block wins). Same for manifest.

# 4. Force HTTPS (cPanel AutoSSL will provide the cert)
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

# 5. No directory listings
Options -Indexes

# 6. Compress text assets
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/css application/javascript application/json image/svg+xml
</IfModule>
