<IfModule mod_rewrite.c>
RewriteEngine On

# The extraction root itself is the Public Edge web base.
# A nested public/ path is invalid in the flat package and is blocked explicitly.
RewriteRule ^public(?:/|$) - [F,L,NC]

# Protect non-public component internals.
RewriteRule ^(?:src|database|resources|tools|storage|var)(?:/|$) - [F,L,NC]
RewriteRule ^(?:config\.php|config\.example\.php|bootstrap\.php|manifest\.json|VERSION\.txt|README\.md|install\.lock)$ - [F,L,NC]

# Physical setup/assets/emergency files are served directly; everything else
# goes through the component-root front controller.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
</IfModule>

<IfModule mod_headers.c>
Header always set X-Content-Type-Options "nosniff"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set X-Frame-Options "DENY"
</IfModule>
