RewriteEngine On

# When public/ is the DocumentRoot, allow its own .htaccess to handle the request.
RewriteRule ^public/ - [L]

# Never expose application internals when the repository root is public.
RewriteRule ^(?:app|config|storage|views)(?:/|$) - [F,END,NC]

# Serve public assets directly, then send every application URL to PHP.
RewriteRule ^assets/(.*)$ public/assets/$1 [END,NC]
RewriteRule ^favicon\.ico$ public/favicon.ico [END,NC]
RewriteRule ^ public/index.php [QSA,END]
