You uploaded your Laravel project to cPanel. Everything works, but the uploaded images don't show. You only see broken image icons.
Why it happens
Laravel saves uploaded files in storage/app/public. Browsers can only see them through a link called public/storage. That link doesn't upload with your files, so it doesn't exist on the server.
Fix 1: With Terminal
Open Terminal in cPanel and run:
cd ~/your-project
php artisan storage:link
Refresh your site. Images should now load.
Fix 2: Without Terminal
Add this route to routes/web.php:
Route::get('/make-link', function () {
Illuminate\Support\Facades\Artisan::call('storage:link');
return 'Done';
});
Open yourdomain.com/make-link once. Then delete the route so nobody else can use it.
Still not working?
- Check that
APP_URLin.envis your real domain, likehttps://yourdomain.com. - Some hosts block links. Ask support to allow symlinks.
Need help with your Laravel project on cPanel? I fix deployment issues here: https://www.fiverr.com/s/YLLm23N
Top comments (0)