Laravel Symlink Link Storage Command Example

Laravel symbolic link storage example: In this tutorial we will show you how to create or use symlink storage using command in laravel application. This example show you laravel command (php artisan storage:link) to create symlink link to concatenate storage and public directory.

You should create a symbolic link from public/storage to storage/app/public. I am going to show you how to create symlink from ‘public/storage’ to ‘storage/app/public’

laravel symbolic link command:

Here is the command to concatenate public and storage folder to save your file in storage folder linked with public directory.

php artisan storage:link

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

For production you can use the below example to create storage symbolic link in laravel domain or subdomain.

by terminal/cmd/shh:

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

routes/web.php

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

Hope its work for you.

Leave a Comment