Home  >  Q&A  >  body text

Create Laravel storage symlinks for production or subdomain systems: a step-by-step guide

<p>When I'm working on the Laravel local development server <code, php="" artisan="" storage:link<="" code=""> works fine for me. However, when I move the site to the production server, I see that my public storage link is a folder. Then I removed the content that was trying to create the link. I'm getting the error because my app is in the root folder and trying to fix this. </code></p>
P粉493313067P粉493313067441 days ago414

reply all(2)I'll reply

  • P粉759457420

    P粉7594574202023-08-28 00:44:42

    Another easy way is to programmatically run the php artisan storage:link command

    On routes/web.php

    Route::get('/foo', function () {
    Artisan::call('storage:link');
    });

    reply
    0
  • P粉133321839

    P粉1333218392023-08-28 00:15:23

    I solved this problem with another command that creates a symlink via terminal/cmd/shh:

    ln -s /path/to/laravel/storage/app/public /path/to/public/storage

    I also solved this problem, using laravel web routing routes/web.php

    Route::get('/foo', function () {
        Artisan::call('storage:link');
    });

    reply
    0
  • Cancelreply