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

Applelay's avatar

Set Up Laravel 5 on Shared Hosting (c-panel)?

Hi, I have to upload the laravel for the web site. So, i uploaded the app folder to public_html. But, it doesn't work. Please help me, to solve that problem.

0 likes
7 replies
Applelay's avatar

Hi, @davidrushton.

Thz u for your sharing, i ask the hosting services to access SSH shell access of c-panel.

Thank u for your kind.

1 like
Applelay's avatar

500 Internal Server Error, still get the error. Why, all bros?

moharrum's avatar

This is what I did for one of my projects:

  1. Upload all the files inside public -> public_html
  2. Create a directory in / and name it laravel or whatever is more convenient for you: So that the directory structure becomes similar to
cgi-bin Directory   ....
laravel Directory   ....
public_html Directory   ....
......
  1. Upload all the other directories/files (config, app, ...) to laravel.
  2. Update public_html/index.php:
// ...
require __DIR__.'/../laravel/bootstrap/autoload.php';
// ...
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';
  1. Update public_html/.htaccess and add at the bottom:
RewriteEngine On
# Redirect Trailing Slashes...
RewriteCond %{REQUEST_URI} !^
RewriteRule ^(.*)$ /$1 [L]
  1. Update .env to your new server settings.
  2. Import your mysql tables.

This is working 100% for me.

1 like
Applelay's avatar

Hi @moharrum,

This is .htaccess in public_html. Did u remove the files in app\public folder?

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]
    RewriteCond %{REQUEST_URI} !^
    RewriteRule ^(.*)$ /$1 [L]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

Please or to participate in this conversation.