# KUETx - Root Apache Configuration
<IfModule mod_rewrite.c>
    RewriteEngine On

    # Prevent directory listing
    Options -Indexes

    # Block sensitive directories and files
    RewriteRule ^(\.git|config|app|database|storage/logs|tests) - [F,L]
    RewriteRule ^(database\.sql|config\.example\.php|composer\.(json|lock)|README\.md) - [F,L]

    # If already in public directory, do nothing
    RewriteCond %{REQUEST_URI} ^/public/ [NC]
    RewriteRule ^ - [L]

    # Route all traffic to public/ folder
    RewriteCond %{REQUEST_URI} !^/public/
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

# 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"
</IfModule>
