# PRESTIGO TRAVEL — Apache configuration for cPanel hosting (installed by install/update zip)

DirectoryIndex index.html index.php
Options -Indexes
ErrorDocument 404 /404.html

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Force HTTPS (enable once AutoSSL has issued your certificate in cPanel → SSL/TLS Status)
  # RewriteCond %{HTTPS} !=on
  # RewriteCond %{HTTP:X-Forwarded-Proto} !https
  # RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  # Private files and folders
  RewriteRule ^(_backups|_updates)(/|$) - [F,L]
  RewriteRule (^|/)\.(?!well-known/) - [F,L]
  RewriteRule \.(sqlite|log|md)$ - [F,L]
  RewriteRule ^prestigo-manifest\.json$ - [F,L]
  RewriteRule ^update\.zip$ - [F,L]
</IfModule>

# Security headers
<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"
</IfModule>

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

# Caching: hashed build assets never change; HTML is revalidated so updates show immediately
<IfModule mod_headers.c>
  <FilesMatch "\.(js|css|woff2?|png|jpe?g|webp|avif|svg|ico)$">
    Header set Cache-Control "public, max-age=604800"
  </FilesMatch>
  <If "%{REQUEST_URI} =~ m#^/_next/static/#">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </If>
  <FilesMatch "\.(html|txt)$">
    Header set Cache-Control "public, max-age=0, must-revalidate"
  </FilesMatch>
</IfModule>
