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

jonecir's avatar

How to move Laravel 5.4 application to shared hosting?

Hello, I just created a simple Laravel 5.4 application using some VueJS components. Now I'd like to move it into my shared hosting account (it has www/public_html structure). In a regular php/html application I would move everything into the "public_html" folder. I spent quite some time searching a solution on the web and could not find any working solution. So I would appreciate some step-by-step guide on how to do it? Thanks a lot.

0 likes
8 replies
Thyrosis's avatar

Adding to the above link:

I've got the same situation. Basically what you do is you put everything in your www folder and then rename the Laravel default 'public' folder to 'public_html'.

Then go into server.php and change the two instances of public to public_html.

That should be it!

If you happen to have SSH access to your shared hosting account and you use NPM/Mix to build your CSS files, there's more tweaking to be done. Laravel/Mix uses the public folder to publish the CSS/JS files from your resources/assets folder. In that case, check these files too:

  • webpack.mix.js
  • node_modules\laravel-mix\setup\webpack.config.js
  • public\mix-manifest.json

(Maybe you could also try to symlink public_html to public -- I haven't tried it, but while I'm typing this reply I'm thinking that could actually work too.)

jonecir's avatar

Hi, I will try to follow the instructions on those links you shared. Should I make any changes on my .env file and compile the application as production instead of development? I mean, while working locally on my application I compile it as "npm run dev". Is there any command such as "npm run production"?.

Thanks a lot.

skoobi's avatar

You can upload your files to a folder public_html/laravel Then transfer the public files into public_html, so the index.php, htaccess and assets etc..

After that you need to point the bootstrap/autoload.php in your index.php

require __DIR__.'/laravel/bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';

and that should be it.

So your folder dir will be

public_html
-/Laravel
--/Laravel/AllAppFiles. too many to list :) 
- index.php
- .htaccess
- /assets
- /assets/css
- /assets/js
1 like
packy's avatar

@skoobi I have this same setup where everything in my 'public' directory has been moved to public_html and all the actual app files are in 'laravel' folder. in my index php I had to have this:

require __DIR__.'/laravel/bootstrap/autoload.php';

$app = require_once __DIR__.'/laravel/bootstrap/app.php';

So I wasnt sure if there was a typo in your comment. The only issue I have now is the app relative path since it looks for storage stuff in root but its actually in laravel folder and some package files from vendor in root as well, but that is in laravel. Any suggestions?

Please or to participate in this conversation.