# Locket Gold Enterprise — fallback rules when the document root cannot be
# changed to /public. Preferred deployment is still: docroot = /public.
#
# Keep this file in the project root. When the host points the domain at
# /public, Apache ignores this file (it is outside the document root).

Options -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine On

    # 1. Never serve secrets, data or source code.
    RewriteRule ^(\.env|\.git|composer\.(json|lock)|database|storage|app|bootstrap|config|routes|resources|tests|scripts|docs)(/|$) - [F,L]

    # 2. Send the site root to the front controller inside /public.
    RewriteRule ^$ public/index.php [L]

    # 3. Route everything else into /public (static files keep working).
    RewriteCond %{REQUEST_URI} !^/public/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

<FilesMatch "\.(env|json|log|md|lock|bak|ini|sql|sh)$">
    Require all denied
</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"
</IfModule>
