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

Jay7's avatar
Level 1

Laravel Forge - 404 Error for resources in public folder

Hello everyone, I know this question may seem similar to many others but it isn't, and I've spent nearly one entire day googling and trying out everything I could find, but I cannot solve these 404 errors.

I have a website currently running on a shared hosting and working perfectly, I need to move it to a more powerful server so I opted for the Forge+DigitalOcean combo as a sure bet to quickly have it up and running but it's been two days and I just can't figure out why no resources from the public folder is being loaded (app.css, images, js files...).

I keep my files directly into the mywebsite.com/public folder (not storage/app/public) so it shouldn't be a symlink problem.

The website routes work, I can visit any page but they just load external resources and html, and get 404 error for everything from the public folder.

I've tried setting up a symlink anyway and it works but no files are found anyway. As a test I've tried putting the files in the storage/app/public folder and set up the symlink with "php artisan storage:link" but nothing, I've set permissions of the public folder to 777 recursively to all files, also countless cache clear, routes clear and so on. If I inspect the generated urls they are correct, the files are there, but if I visit them I get a 404 error.

This app is currently working perfectly fine locally as well as on a shared hosting so there are no mistakes in my routes, urls, or anything related to wrong links or misplaced files, I'm quite sure it has to be something specific to this server configuration, but I really can't think of anything else anymore.

0 likes
5 replies
ousid's avatar

Have tried to configure your APP_URL inside the .env?

Or you can delete the cached packages/services manually by deleting bootstrap/cache php file

Jay7's avatar
Level 1

Yes I configured the right url in the .env file, and unfortunately deleting the bootstrap cache files didn't make any difference...

Jay7's avatar
Level 1

Any ideas anyone? Sorry for upping, but I still haven't found a soultion yet...

Jay7's avatar
Jay7
OP
Best Answer
Level 1

Found a solution, for those having the same issue the problem was solved from the "Meta" panel in forge, where you can set a "Web Directory" folder. That folder was set to "/public" but my app was already set so that all links where explicitly linking to the public folder, and so with that setting all resources where basically linking to mywebsite.com/public/public/resource. Deleting the content of that field solved the problem.

1 like
amrinder_bajwa's avatar

I had the same issue as initially I setup the sub-domain to index.php file inside public folder like "example.com/public/index.php". Changing it to "example.com/public/" directory fixed the issue.

1 like

Please or to participate in this conversation.