Options -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Prevent direct access to the actual /public path from the browser.
    RewriteRule ^public/ - [L,R=404]

    # Send every request through the public front controller or public assets.
    RewriteCond %{REQUEST_URI} !^/public/
    RewriteCond %{DOCUMENT_ROOT}/public%{REQUEST_URI} -f [OR]
    RewriteCond %{DOCUMENT_ROOT}/public%{REQUEST_URI} -d
    RewriteRule ^(.*)$ public/$1 [L]

    RewriteCond %{REQUEST_URI} !^/public/
    RewriteRule ^(.*)$ public/index.php [L]
</IfModule>
