I don't know your entire folder structure. But when laravel is setup to point to public as the documents root all works correctly.
Public can be renamed however. But see this, but search other past answers as well:
and
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am running a laravel app on a shared hoster. When calling app()->path() I get /home/httpd/vhosts/firefly.ch/statamic-firefly/app which is correct. When running the same in cli tinker I get /statamic/firefly/app which is wrong and because of that artisan optimize generates the wrong paths in the cache. I guess the issue is that my entrypoint via ssh is /home/httpd/vhosts/firefly.ch which makes this my root directory and causes the wrong path. I contacted the hosting provider and asked if they could change my ssh config to start at /. The response was "For most frameworks/systems it's possible to adjust the path the cli uses." Googled for that but did't find a config parameter. Any suggestions?
So the solution was the above plus creating the desired folder structure with symlinks pointing to /.
Please or to participate in this conversation.