How to create laravel storage symbolic link for production or sub domain system?

Mizanur Rahman Khan picture Mizanur Rahman Khan · Aug 22, 2017 · Viewed 33.3k times · Source

When I worked on laravel local development server php artisan storage:link works fine for me. But when I transfer my site to production server then I saw my public storage link was a folder. Then I delete that tried to create a link. I got an error because my app was in the root folder and tried to solve this problem.

Answer

Mizanur Rahman Khan picture Mizanur Rahman Khan · Aug 22, 2017

I solved this problem by another command for creating a symbolic link by terminal/cmd/shh:

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

I solved this also Using laravel web route routes/web.php

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