Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Adams_'s avatar

All Images on live sever return 404 (Not Found)

I deployed a new site with the forge default domain, just to test the site on a live server, everything was successful, migrated the database and seeded it, but now every single image on the site is returning 404 not found, I run the storage link command still nothing change.

So please anyone with an idea how to fix it should help. I am also new to deployment and server stuff, this is my first time deploying a site on a live server.

0 likes
27 replies
jlrdw's avatar

Try using a Linux symbolic link.

1 like
Sinnbeck's avatar

What's the path to one of these images? Can you find it in the public directory?

1 like
Adams_'s avatar

@Sinnbeck I discovered that the storage folder, public/storage folder link are listed in gitignore file so I commented those lines and push update now the images are all showing.

Sinnbeck's avatar

@Adams_ It should be in git ignore!! You dont want files that are uploaded in source control. That directory is for uploaded files, not files you need for the site to work. Put those files info a directory like /public/images

1 like
Adams_'s avatar

@Sinnbeck However node_modules folder is also in the gitignore and vendor folder too, so they are not included in the current repository, I attempt to push node_modules and I get a warning that it is too large, is over 100 MB, so what do you think I should do? should I go ahead and push node_modules and vendor folder to github and the server?

Adams_'s avatar

@Sinnbeck wow I messed up i guess, thank you fr that I would do that, so files that the site need to work should be in public/images not public/storage/images ? including seeded files ?

Sinnbeck's avatar

@Adams_ Correct. storage is just for storing things. :) Not sure why seeding is adding files that are required for the site to function ?

Also node_modules and vendor at there for a reason. You should not add them! On the server you run composer install and it will install it. And if you need to compile your js/css on the server, you run npm install. But if you dont need to compile assets you dont need node_modules

Sinnbeck's avatar

Feel free to ask here if you are in doubt of why files are in gitignore. They are there for a reason :)

Adams_'s avatar

@Sinnbeck Alright, node_modules and vendor out I am not adding them, I meant to say seeded data, like dummy data, images names in the tables and I point the images in the storage with those names like

{{ asset('storage/blog_images/image.jpg') }} 
Sinnbeck's avatar

@Adams_ But isnt that just for testing stuff locally or does your production server need it to work? :) If it needs it, run the seeder there

Sinnbeck's avatar

You can think of /storage a bit like your database. You dont commit your local database to production either :)

Adams_'s avatar

@Sinnbeck yeah it is for testing, but I thought I would love the site to go on production with little data on it, but I now changed my mind. I am just going to wipe out everything and install the repo on the server again.

Sinnbeck's avatar

@Adams_ Sounds good :) Thats the way to go. If production needs data, you set up a seeder and run it there :)

Adams_'s avatar

@Sinnbeck You absolutely right u don't commit local database to production :)

Sinnbeck's avatar

@Adams_ Happy to help. If there are no more questions, please set the thread as solved :)

Adams_'s avatar

@Sinnbeck Is it okay to ask questions related to this discussion here or open a new discussion considering I marked it as solved?

Sinnbeck's avatar

@Adams_ Yeah as long as it is related you are free to ask :) If it is a whole new thing, it is best to start a new thread so others can help out as well (people are less likely to check solved threads)

Adams_'s avatar

@Sinnbeck Okay so I am getting a 404 not found error when I upload an image to the site, I checked the directory the images are supposed to be saved on the server it doesn't exist because gitignore the storage folder where the images are supposed to be saved. for example, profile images are supposed to be saved in public/storage/profile-images folder. I think that is what is causing the error and if that is the case what to do pls?

Sinnbeck's avatar

@Adams_ You need to run php artisan storage:link on the server for the /public/storage directory to show up. After the command the folder should show up, and images start to work

1 like
Adams_'s avatar

@Sinnbeck okay I did run storage:link but I got storage already exists, I checked the original storage folder and the image is there in storage/app/public/profile-photos but the public/storage link folder is empty.

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@Adams_ Then delete it. The empty one

This one /public/storage.

NOT this one /storage/app/public

And then run the command again

1 like
Sinnbeck's avatar

@Adams_ I honestly don't know. Don't have a subscription myself. It's also quite difficult depending if you are running windows (I use Linux myself)

1 like

Please or to participate in this conversation.