# RentFlow PHP — Apache Configuration
# Place this in your rentflow/ folder on XAMPP or cPanel

Options -Indexes
ServerSignature Off

# ── Security Headers ──────────────────────────────────────────
<IfModule mod_headers.c>
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-Frame-Options "SAMEORIGIN"
    Header always set X-XSS-Protection "1; mode=block"
    Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

# ── Protect config.php ───────────────────────────────────────
<Files "config.php">
    Order allow,deny
    Deny from all
</Files>

# ── Clean URLs: /demo → /index.php ───────────────────────────
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /rentflow/

    # Block direct access to patched app file
    RewriteRule ^app_patched\.html$ index.php [R=302,L]

    # Everything else serves index.php if not a real file/dir
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php [L,QSA]
</IfModule>

# ── Cache static assets ───────────────────────────────────────
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css   "access plus 1 month"
    ExpiresByType text/javascript "access plus 1 month"
    ExpiresByType image/png  "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 year"
</IfModule>

# ── Prevent access to backup and log files ────────────────────
<FilesMatch "\.(sql|log|bak|backup|json)$">
    Order allow,deny
    Deny from all
</FilesMatch>
