Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bbredewold's avatar

Access Directory Contents

Hi there,

Trying to deploy my first laravel app. Since Laravel is working best in the root directory, I installed it there.

In that same root directory are some other folders, i'd like to access. And with access, i mean list those directories. (See the contents in the browser. It's an old assets dir. I just want to have access to it.) But Laravel tries to parse it as a route. I know my .htaccess is set to go to the directory if it exists, but it's going into an infinite redirection loop.

Anyone know how to solve this problem?

Thanks!

0 likes
1 reply
bbredewold's avatar

Yey! I fixed my own problem :)

I added a line to the default .htaccess in the /public folder:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteCond %{REQUEST_FILENAME} !-d <---- THIS ONE :)
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Please or to participate in this conversation.