Laravel - How to revert local storage symlink and refresh

Stefan Izdrail

Founder & Senior Architect · 2026-06-29

Laravel Company
Title: Laravel - A Comprehensive Guide on Reverting Local Storage Symlink and Refreshing Your Development Environment Body:

When you work with Laravel, you might occasionally encounter issues related to local storage symlinks and their visibility in your application. In this blog post, we'll address the problem, provide a solution, and offer tips on how to prevent similar issues from happening in the future.

The Issue

As you mentioned, when saving images or files to storage, they appear within storage/app, but not in your public directory (i.e., at public/storage). Additionally, a storage/app/public folder seems to have been created that also contains the contents of the storage/app directory. This can be problematic and might affect the appearance or functionality of your application.

The Possible Cause

This issue most likely occurs due to incorrectly setting up the symlink between the public and storage directories during Laravel's installation process. Symlinks are essentially pointers that point files or folders at their actual location, allowing you to access them from a different path. In this case, the symlink should have been created in reverse—from the public folder to the storage directory.

The Solution

To revert this issue and restore your local environment, you can follow these steps:

1. Firstly, make sure not to save or upload any files in your application while working on this process as it might overwrite the changes we're about to make. 2. Delete the storage/app directory, since we don't need it anymore. This will remove all data that appears under both locations. 3. Remove the storage/app/public directory if it exists. It should be empty by this point anyway. 4. Open your command prompt or terminal and navigate to the root folder of your Laravel project. 5. Run the following command: php artisan storage:link. This will automatically create a symlink between the public/storage directory and your storage folder, ensuring that files are accessible from both locations. 6. Clear your browser cache and reload the application to ensure any changes have taken effect.

Preventing Future Errors

Now that this issue is resolved, you can avoid similar problems in the future by following these best practices:

- Always create a new Laravel project with composer create-project --prefer-dist laravel/laravel my-app to ensure that the symlink setup is correct. - Use your preferred text editor or IDE and follow proper code indentation, especially when defining routes, controllers, views, etc. This helps maintain consistency in your application's structure. - Periodically run php artisan optimize, composer install --no-dev, and npm install --save to ensure all dependencies are up-to-date. - Keep your Laravel version updated by running the following command: composer update laravel/framework laravel/installer laravel/telescope -vv.

Conclusion

By addressing this issue and taking preventative measures, you can maintain a stable Laravel development environment. If you encounter any further challenges or have questions regarding your Laravel application, feel free to reach out to the experts at Laravel Company. They'll be happy to provide guidance and support.