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

Respect's avatar

How deploy laravel to cpanel without moving public folder files to public_html

Hello Friends How to deploy laravel app to cpanel with out moving public directory files to public_html folder cuz i dont eed to lose symlink storage folder for images ////////// Any Idea To by htaccess or what ever

0 likes
6 replies
nikavr77's avatar

Hi,

Try this procedure:

copy everything from laravelproject/public to public_html

open public_html/index.php and set:

require DIR.'/../laravelproject/bootstrap/autoload.php';

$app = require_once DIR.'/../laravelproject/bootstrap/start.php';

Finally in index.php (top pf the file) add this line: ini_set('eaccelerator.enable', 0);

Respect's avatar

ty bro for answer but i don't need move public folder files to public_html cuz i dont need to lose symlink images path Storage folder

nikavr77's avatar
nikavr77
Best Answer
Level 2

Have you try this on .htaccess:

RewriteEngine on

RewriteCond %{REQUEST_URI} !^public

RewriteRule ^(.*)$ public/$1 [L]

Respect's avatar

@NIKAVR77 - sorry for late .. it worked thanks so much i marked your answer after 50 days sorry for late

jlrdw's avatar

Have you made sure this setup is secure my typing:

Yoursite/.env

If your environment file can be read you're not secure.

Please or to participate in this conversation.