# Locket Gold Enterprise — Apache rules for shared hosting.
Options -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Block direct access to sensitive files
    RewriteRule ^(\.env|\.git|composer\.(json|lock)|database|storage|app|bootstrap|config|routes|resources|tests|scripts)(/|$) - [F,L]

    # Send everything that is not a real file/dir to the front controller
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ index.php [L]
</IfModule>

<FilesMatch "\.(env|json|log|md|lock|bak|ini)$">
    Require all denied
</FilesMatch>

# Deny the JSON database directory when docroot is the project root
<IfModule mod_rewrite.c>
    RewriteRule ^database/ - [F,L]
    RewriteRule ^storage/ - [F,L]
</IfModule>

<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>

# PHP settings commonly available on shared hosts
<IfModule mod_php.c>
    php_value upload_max_filesize 4M
    php_value post_max_size 6M
</IfModule>
