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

metriakon's avatar

Error 500 on shared hosting after changin app folder

Hello. I got a folder structure

/home/usrname/domains/domain.com/public_html

And i want to move laravel files from public html to domain.com/laravel so i change index.php in public_html to:

require (dirname(__DIR__) . "/laravel/vendor/autoload.php");

which gives me the /home/usrname/domains/domain.com/laravel/vendor/autoload.php path.

$app = require_once (dirname(__DIR__) . "/laravel/bootstrap/app.php");

After that still got a error 500. Permissions: 755.

server.php in laravel folder:

<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <[email protected]>
 */

$uri = urldecode(
    parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);

if ($uri !== '/' && file_exists(__DIR__.'/../public_html'.$uri)) { 
    return false;
}

require_once __DIR__.'/../public_html/index.php';
0 likes
6 replies
MichalOravec's avatar

Don't change app, public folders or anything else, change hosting provider.

jlrdw's avatar

Irregardless of folder structure, still point to public as your document root.

Or move main laravel above public_html. I have a reference to a guide if you need it, but it's pretty straightforward.

But set it up correctly.

3 likes
metriakon's avatar

so what should i do? As everything was in public_html, it worked. The path is correct because echo works for example in autoload.php

Snapey's avatar

create a folder. put your Laravel project in it (without tampering with the index.php)

delete the public_html folder

create a symlink that points public_html to the laravel/public folder

2 likes

Please or to participate in this conversation.