Custom URL in Laravel Storage

Installation

laravel new customstorageurl
cd customstoreurl
php artisan storage:link
Storage symlink in Laravel
Laravel Storage symlink with files
http://domain.com/storage/laravel-logo.png

Customizing Laravel Storage links

cd public
mv storage custom
Renaming storage symlink in Laravel
http://domain.com/custom/laravel-logo.png

Setting up The Storage Facade

Storage::url('laravel-logo.png');
  1. Add in your .env (remember to restart your server after changing environment variables):
FILESYSTEM_DRIVER=public
'public' => [  'driver' => 'local',  'root' => storage_path('app/public'),  'url' => env('APP_URL').'/storage',  'visibility' => 'public',],
'public' => [  'driver' => 'local',  'root' => storage_path('app/public'),  'url' => env('APP_URL').'/custom',  'visibility' => 'public',],

What’s next?

--

--

Web Developer. Soccer fan. https://aleksandertabor.pl

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store