# Psy-TOT — Namecheap (LiteSpeed/Apache)
Options -Indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>
  RewriteEngine On
  # Force HTTPS
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP:X-Forwarded-Proto} !https
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  # Block private folders and dotfiles
  RewriteRule ^(includes|data)(/|$) - [F,L]
  RewriteRule (^|/)\. - [F,L]
</IfModule>

<FilesMatch "\.(sqlite|sqlite-wal|sqlite-shm|db|log|md|sql|bak|ini|zip)$">
  Require all denied
</FilesMatch>

<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 Permissions-Policy "camera=(), microphone=(), geolocation=()"
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set Strict-Transport-Security "max-age=31536000" env=HTTPS
  <FilesMatch "\.(webp|png|jpg|svg|css|js|woff2|pdf)$">
    Header set Cache-Control "public, max-age=2592000"
  </FilesMatch>
  <FilesMatch "\.php$">
    Header set Cache-Control "no-cache, private"
  </FilesMatch>
</IfModule>

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