Search code examples
laravelstoragesymlink

Laravel - How to revert local storage symlink and refresh


When I save images to storage they show in the storage/app directory, but they don't show in public/storage. I also noticed that a storage/app/public directory seems to have been created which also contains everything within storage/app.

I can't work out how I managed to cause this mess, and I think it might make sense to revert these directories to how it should have been to begin with (with a new laravel project), remove any existing symlinks, and start again - does this sound like the best approach? And how would I go about doing this if I have set the symlink up incorrectly?


Solution

  • You can always delete the link:

    cd public
    rm storage
    

    And create a new one without using the storage:link command if you need to link different locations:

    \File::link(storage_path('dir1'), public_path('dir2'));
    

    Or create a symlink manually:

    ln -s /full/path/to/storage/dir1 /full/path/to/public/dir2