Skip to content

Step 8 of 10

Fix storage:link on shared hosting

Files saved to the public disk live in storage/app/public. Visitors reach them through a link at public_html/storage. When that link is wrong, uploaded images give a 404.

Create the link

With your code outside public_html, php artisan storage:link creates the link in laravel-app/public, which no visitor can reach. Create it yourself, using full paths:

ln -s /home/cpaneluser/laravel-app/storage/app/public /home/cpaneluser/public_html/storage

Without a Terminal

  1. 1

    In cPanel → Cron Jobs, add the ln -s command above as a job set to run every 5 minutes.

  2. 2

    Wait for it to run once, and check that public_html/storage appears in File Manager.

  3. 3

    Delete the cron job.

If it still doesn't work

  • Is public_html/storage a real folder from an upload? Delete it first, or ln -s puts the link inside it.
  • A 403 on images means the host needs Options +SymLinksIfOwnerMatch in .htaccess.
  • Check APP_URL: wrong image addresses often come from a wrong value here.
  • If your host blocks symlinks, save uploads straight into public_html with a disk whose root is that folder.

Frequently asked questions

Can I use a PHP route to run storage:link?

You can, but remove it straight after, and it still creates the link in the wrong folder unless you change config/filesystems.php. The ln -s command is simpler.

Get new articles in your inbox

Practical tutorials and deep dives, about once a week. No spam, unsubscribe anytime.

Privacy policy

Add DEV Talk to your Home Screen

  1. 1 Tap the Share button in Safari's toolbar.
  2. 2 Scroll down and tap Add to Home Screen.
  3. 3 Tap Add. Open it from the Home Screen to read like an app and to turn on notifications with the bell.

We use cookies to improve your experience and analyze traffic. By continuing, you agree to our Privacy Policy.