Options -Indexes
DirectoryIndex index.php

RewriteEngine On

# Protect application internals when the project folder itself is the document root.
RewriteRule ^(?:app|config|database|storage)(?:/|$) - [F,L]

# Installer remains intentionally accessible for first deployment.
RewriteRule ^install(?:/|$) - [L]

# Allow direct public assets/pages for compatibility.
RewriteRule ^public(?:/|$) - [L]

# Clean asset URLs.
RewriteRule ^assets/(.*)$ public/assets/$1 [L]

# Clean application PHP URLs.
RewriteRule ^([A-Za-z0-9_-]+\.php)$ public/$1 [L]

# Root is the public product funnel/home page.
RewriteRule ^$ index.php [L]

<FilesMatch "(^\.|\.sql$|config\.php$)">
    Require all denied
</FilesMatch>
