Everything. Don't change the structure in the php files. 2 options
- Put the files in the same folder as public_html. Delete public_html and symlink public to it
- Put them inside public_html and use an htaccess file to point to the public folder
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm trying to deploy my laravel project on shared hosting Cpanel. But I'm getting a 404 error. When I'm trying to move some files, I accidentally make a public_html folder, so I deleted it (I'm pretty sure I deleted the folder I make, not the real public_html).
I changed the following lines in index.php
require __DIR__.'/../vendor/autoload.php';
to
require __DIR__.'/../laravel/vendor/autoload.php';
I also did the same thing to
$app = require_once __DIR__.'/../bootstrap/app.php';
What could be wrong with this deployment approach?
Please or to participate in this conversation.