Reputation: 5215
I am using Laravel Framework 8.68.0
.
I am having the following configuration in my filesystems.php
:
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
'public_collectible_img' => [
'driver' => 'local',
'root' => storage_path('app/public/collectibles_img'),
'url' => env('APP_URL').'/collectible/image',
'visibility' => 'public',
],
The following link works:
http://localhost/myProject/public/storage/collectibles_img/0_test.jpg
The following link does not work:
http://localhost/myProject/public/collectible/image/0_test.jpg
All my images are in the following folder:
Any suggestion why my second link does not work?
I appreciate your replies!
Upvotes: 0
Views: 219
Reputation: 1117
The filesystems.php
only affects Laravel's internal filesystem management (e.g. moving a file from within Laravel, saving an uploaded file, etc.), not the actual HTTP server which is what serves static files such as images. If you want to have a custom URL, you can either modify your web server's configuration (e.g. .htaccess
), or create a Laravel route and controller to serve files from within Laravel. The latter approach will require that you map the requests to files yourself, and each request would have the overhead of loading PHP.
Alternatively, you could create a symlink from public/storage/collectibles_img
to public/collectible/image
(you would need to create the collectible
folder first, then set up collectible/image
as a symlink to public/storage/collectibles_img
).
Upvotes: 1