RewriteEngine On

# Blokkeer directe toegang tot gevoelige mappen
RewriteRule ^(app|config|database|storage|vendor)/ - [F,L]

# Blokkeer gevoelige bestanden
RewriteRule \.(env|sql|sh|md|log)$ - [F,L]

# Laat bestaande bestanden in public/ door
RewriteCond %{REQUEST_URI} ^(.*/)?public/ [NC]
RewriteRule ^ - [L]

# Stuur alles door naar public/index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/index.php [QSA,L]

# Als root wordt bezocht, stuur naar public/index.php
RewriteRule ^$ public/index.php [L]
