# ==========================================================================
#  WINIXSTORE × AQUAMC — public/ (the ONLY directory exposed to the web)
# ==========================================================================

Options -Indexes
DirectoryIndex index.php

# ---- Default charset & MIME -------------------------------------------------
AddDefaultCharset UTF-8
AddType application/json .json

# ---- Hide sensitive files ---------------------------------------------------
<FilesMatch "\.(env|log|sql|sqlite|sqlite3|ini|conf|bak|old|swp)$">
    Require all denied
</FilesMatch>

<FilesMatch "^\.">
    Require all denied
</FilesMatch>

# ---- Security headers (defence in depth; also set by PHP) -------------------
<IfModule mod_headers.c>
    Header always set X-Content-Type-Options "nosniff"
    Header always set Referrer-Policy "strict-origin-when-cross-origin"
    Header set X-Permitted-Cross-Domain-Policies "none"
</IfModule>

# ---- Pretty URLs ------------------------------------------------------------
<IfModule mod_rewrite.c>
    RewriteEngine On

    # Force HTTPS when available (uncomment in production behind a valid cert)
    # RewriteCond %{HTTPS} !=on
    # RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ index.php [QSA,L]
</IfModule>

# PHP hardening (safe defaults; adjust per host)
<IfModule mod_php.c>
    php_flag expose_php Off
    php_value session.cookie_httponly 1
    php_value session.use_strict_mode 1
</IfModule>
