If you're able to remove the public_html directory, you might be able to create a symlink:
ln -s public public_html
Or alternatively checkout this guide: https://doc.koetsierengineering.nl/change-public-dir-of-laravel-5-on-shared-hosting/
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, when i create subdomain in hosting hosting create subdomain public in public html. public_html/sub_public_html. i upload laravel files /laravel root folder and change index directory to /laravel/public_html/sub_public_html but not work
Ok, I solved
$vendor_path = realpath("/home/hosting/laravel/vendor/autoload.php");
$bootstrap_path = realpath("/home/hosting/laravel/bootstrap/app.php");
require $vendor_path;
$app = require_once $bootstrap_path;
// require __DIR__.'/laravel/vendor/autoload.php';
// $app = require_once __DIR__.'/laravel/bootstrap/app.php';
Please or to participate in this conversation.