# Gestionale Prestazione Occasionale
Options -Indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>
  RewriteEngine On
  # HTTPS obbligatorio per tutti i file del gestionale (eccetto le prove in locale)
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP:X-Forwarded-Proto} !=https
  RewriteCond %{HTTP:X-Forwarded-SSL} !=on
  RewriteCond %{HTTP_HOST} !^(localhost|127\.0\.0\.1)(:[0-9]+)?$ [NC]
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  RewriteRule ^(data|inc|lib)(/|$) - [F,L]
</IfModule>

<FilesMatch "\.(db|sqlite|ini|log|bak|sql|csv|key|json)$|^\.">
  Require all denied
</FilesMatch>
<Files "config.php">
  Require all denied
</Files>

<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always unset X-Powered-By
  Header always set Strict-Transport-Security "max-age=31536000" "expr=%{HTTPS} == 'on'"
</IfModule>
