Options -Indexes
Options -MultiViews
RewriteEngine On

# ── Policy pages ──
RewriteRule ^(privacy-policy|terms-of-service|terms-conditions|refund-policy|legal-policy|abuse-policy|risk-disclosure|cookie-policy)/?$ policy.php?slug=$1 [L,QSA,NC]

# ── Extra routes ──
RewriteRule ^support/?$ support.php [L]

# ── Blog routes ──
RewriteRule ^blog/?$ blog.php [L]
RewriteRule ^blog/([a-z0-9-]+)/?$ blog-post.php?slug=$1 [L,QSA]

# ── Remove .php extensions ──
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

# ── Block direct access to includes ──
RewriteRule ^includes/ - [F,L]

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

ServerSignature Off

<FilesMatch "\.(env|json|lock|log|sql|md|git)$">
    Order Allow,Deny
    Deny from all
</FilesMatch>

<IfModule mod_rewrite.c>
    RewriteCond %{HTTP_USER_AGENT} (sqlmap|nikto|nmap|masscan|acunetix|nessus) [NC]
    RewriteRule .* - [F,L]
</IfModule>
