# SectorLocker Root Apache Configuration (cPanel Compatible)
Options -Indexes

# Block direct access to sensitive files (.env, sql, md, lock, log)
<FilesMatch "^(\.env(\..*)?|\.htaccess|\.gitignore|.*\.sql|.*\.log)$">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order allow,deny
        Deny from all
    </IfModule>
</FilesMatch>

<IfModule mod_headers.c>
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set Referrer-Policy "strict-origin-when-cross-origin"
    Header set Permissions-Policy "geolocation=(), microphone=(), camera=()"
</IfModule>

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/css application/javascript application/json application/xml
</IfModule>

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType image/jpeg "access plus 6 months"
    ExpiresByType image/png "access plus 6 months"
    ExpiresByType image/webp "access plus 6 months"
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Clean SEO URLs
    RewriteRule ^product/([a-zA-Z0-9\-]+)/?$ product.php?slug=$1 [L,QSA]
    RewriteRule ^page/([a-zA-Z0-9\-]+)/?$ page.php?slug=$1 [L,QSA]
    RewriteRule ^track/?$ track.php [L,QSA]
    RewriteRule ^checkout/?$ checkout.php [L,QSA]
    RewriteRule ^login/?$ login.php [L,QSA]
    RewriteRule ^signup/?$ signup.php [L,QSA]
    RewriteRule ^account/?$ account.php [L,QSA]
    RewriteRule ^sitemap\.xml$ sitemap.php [L,QSA]
</IfModule>
