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



PHP Snippet 1:

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

PHP Snippet 2:

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

PHP Snippet 3:

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

PHP Snippet 4:

$ mv storage /home/yourHostinInfo/domains/domainName/public_html

PHP Snippet 5:

Route::get('/link', function () {        
   $target = '/home/public_html/storage/app/public';
   $shortcut = '/home/public_html/public/storage';
   symlink($target, $shortcut);
});

PHP Snippet 6:

ln -s target_path link_path

PHP Snippet 7:

ln -s /home/cpanel_username/project_name/storage/app/public /home/cpanel_sername/project_name/public/storage

PHP Snippet 8:

/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/

'links' => [
    public_path('storage') => storage_path('app/public'),
],

PHP Snippet 9:

/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/

'links' => [
    base_path('public_html/storage') => storage_path('app/public'),
],

PHP Snippet 10:

ln -s /home/u16345434/domains/website.name/storage/app/public /home/u16345434/domains/website.name/public_html/storage

PHP Snippet 11:

php artisan storage:link

PHP Snippet 12:

cd /path/to/your/domain/public_html

PHP Snippet 13:

php artisan storage:link