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

marcQ's avatar
Level 1

Laravel 5.5 | Migration from production server to local installation (laragon) | Awkward link to public folder

I migrate a copy of my app from my production server to a local machine (laragon).

Connection to database work fine, just have an issue with broken link | url to css and js files when I'm loading the home page resulting in no style.

After migrating my app, I moved the following files :

.htaccess
favicon.ico
index.php
robots.txt
web.config

I changed in the index.php file the following :

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/

require __DIR__.'bootstrap/autoload.php';

to

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

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

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

to

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

In the env. file I set :

APP_URL=http://localhost

as the application url

Console error are among other the following :

bootstrap.min.css
url : http://mage.local/public/public/vendor/crudbooster/assets/adminlte/bootstrap/css/bootstrap.min.css
Failed to load resource: the server responded with a status of 404 (Not Found)


AdminLTE.min.css
url : http://mage.local/public/public/vendor/crudbooster/assets/adminlte/dist/css/AdminLTE.min.css
Failed to load resource: the server responded with a status of 404 (Not Found)

I saw the error by looking at the url which have the folder public set twice :

.../public/public/...

but I have no clue how to solve this issue. Would appreciate your expertise here. Thanks.

0 likes
7 replies
aurawindsurfing's avatar

Hi @marcq

When you say I migrated you mean that you simply took the folder from your server and pasted it to your local server laragon???

There is dozen reasons this might not work. The best way would be for you to create a git repo with your code if id does not yet exist. Install that on your local machine and then follow the installation steps that might vary in your case. Things like

generate app key

create storage like

npm install

composer install

and many more.

Hope it helps!

Snapey's avatar
Snapey
Best Answer
Level 122

revert all the changes you made and set the public folder as the document root for your webserver

1 like
marcQ's avatar
Level 1

@aurawindsurfing Thank you for your time and sharing your method.

@snapey Thank you for your easy solution. I had only to change the document root into my Laragon Virtual host and everything is fine now. Cheers

marcQ's avatar
Level 1

SOLUTION IN DETAIL :

  1. Copy your entire app into your local folder
  2. Don't change anything from the Laravel App configuration
  3. Change the virtualhost document root accordingly (for me which is using Laragon, I just add to go to the menu : Apache | Site enabled | and choose the file related to your site, in my case auto.APPNAME.local.cong
<VirtualHost *:80> 
    DocumentRoot "F:/PROJECTS/www/APPNAME/"
    ServerName mage.local
    ServerAlias *.mage.local
    <Directory "F:/PROJECTS/www/APPNAME/">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

In my case I had :

   DocumentRoot "F:/PROJECTS/www/APPNAME/public/"

I change it in :

   DocumentRoot "F:/PROJECTS/www/APPNAME/"

And magic it is working as expected, Bootstrap CSS is back.

Snapey's avatar

oh dear

thats the wrong way around. The public folder should always be the document root. If whatyou just posted is correct then your live server is vulnerable to being broken into.

marcQ's avatar
Level 1

Thank you @snapey,

The public folder is the document root on the production server, so no threat issues there.

So I haven't figure it out to solve this issue on the local server.

marcQ's avatar
Level 1

If anyone could point me in the right direction, I would appreciate.

I'm sure that some high levels laracasts experts already know how to fix this issue on my local installation. It is my first Laravel App and sadly I'm not omniscient, sorry... Thanks in advance.

Please or to participate in this conversation.