# ── Dusk Roleplay Forums — Apache config (.htaccess) ──────────────────────────
# Shared hosting compatible — no VirtualHost or mod_env needed.
# All configuration is done in config.php directly.

Options -Indexes
RewriteEngine On
RewriteBase /forum/

# ── Block direct access to config.php ────────────────────────────────────────
<Files "config.php">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order allow,deny
        Deny from all
    </IfModule>
</Files>

# ── SPA fallback ──────────────────────────────────────────────────────────────
# Let actual files (api.php, test.php, etc.) pass through untouched.
# Route everything else to index.html.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.html [L]

# ── Security headers ──────────────────────────────────────────────────────────
<IfModule mod_headers.c>
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-Frame-Options "SAMEORIGIN"
    Header always set Referrer-Policy "same-origin"
</IfModule>

# ── PHP settings (shared hosting) ────────────────────────────────────────────
<IfModule mod_php.c>
    php_value session.cookie_httponly 1
    php_value session.use_strict_mode 1
    php_flag  session.cookie_samesite Lax
</IfModule>
