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

LaraBABA's avatar

From local to shared hosting

Hello,

I have a quick question please.

I have uploaded laravel to a folder above the public_html as: www.site.com/laravel

I have then moved the content of the public folder into the public_html area.

I understand that no images will be uploaded to the storage folder until I use the simlink command.

My question is, if I move the content of the public folder into the public_html directory, do I still need to keep the public folder in the www.site.com/laravel/public folder? Or can I get rid of it?

Thanks,

0 likes
6 replies
bobbybouwmann's avatar

You don't need the public directory anymore. Your public_html directory is the new public directory. As long as your index.php is in the public_html directory you are good to go!

Note that there is a reference to the public directory in config/filesystems.php. If you use that, you need to make sure you replace it ;)

Let me know if you have any problems setting this up!

1 like
jdunsmore's avatar

Easiest solution is to tell your web server to use the public folder that ships with Laravel as the root of the site.

This is fairly simple with CPanel or with unmanaged through your .conf files.

LaraBABA's avatar

I tried so many things with my hosting provider on the vps, just can't get the images to show up.

Quick question, let's say I have this setup: public_html/index.php public_html/laravel/[all the laravel folders here)

If I create the symlink, with the symlink command it creates the link from public_html/laravel/storage/app/public/ to public_html/laravel/public/storage

Now what I don't get is that I ran the command via ssh, the folder is there but not accessible via ftp.

Usually, when simlinked, can you open it or not via ftp?

I am really struggling with this.

Now the other thing I do not understand is that some people say to put the whole laravel install in the public_html folder

Other say to put it in a folder above as: public_html/laravel/

What difference would it make from public_html to public_html/laravel?

Others say to have it below the public_html for maximum security but this won't be ideal for me.

jdunsmore's avatar
Level 2

Personal experience I've done the "dump the files in public folder into public_html" and then create a laravel folder method of hosting and its a total nightmare.

Like I suggested above, point your servers entry point to the laravel public folder and you won't need to change any of the entry points for Laravel.

Once you've done that your symlink should create itself by running the artisan command:

php artisan storage:link

Note that will only work if the folder that the symlink creates doesn't already exist.

1 like
LaraBABA's avatar

Superb, Thanks, I will give it a shot and let you know the results

LaraBABA's avatar

works superb thanks!

All you have to do is add this in the htaccess of the public_html

 RewriteEngine On

    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/ [L]

Please or to participate in this conversation.