DEV Community

MUHAMMAD Roman Ali
MUHAMMAD Roman Ali

Posted on

Laravel Images Not Showing on cPanel? Fix It in 2 Minutes

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
Enter fullscreen mode Exit fullscreen mode

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';
});
Enter fullscreen mode Exit fullscreen mode

Open yourdomain.com/make-link once. Then delete the route so nobody else can use it.

Still not working?

  • Check that APP_URL in .env is your real domain, like https://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)