RewriteEngine On

<FilesMatch "^(config\.php|composer\.(json|lock)|\.env)$">
	Require all denied
</FilesMatch>

# Handle installer
RewriteRule ^install/?$ install/index.php [L,QSA]

# Redirect everything else to public/index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/index.php/$1 [L,QSA]

# Protect sensitive directories
RewriteRule ^(config|database|storage|app|themes)/ - [F,L]
