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

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


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');});


Another simple way is to run Executing php artisan storage:link Command Programmatically

On routes/web.php

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


assuming that your laravel project "public" directory and "public_html" directory are different. Or your subdomain pointer directory may be different , then use your subdomain pointer directory like "public_html" below given process.

apply command: $ php artisan storage:link

this command will create symlink to "public" directory to your laravel project. not inside the "public_html" . so we need to move the "storage" link to "public_html" directory. for this you can move directly. if it doesn't work then move it using command . go inside the "public" directory and run the below command according to your "public_html" directory location.

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

the path might be different based on your hosting information.