Answer the question
In order to leave comments, you need to log in
Why is storage/app/public symlink not working in Laravel?
Good afternoon. After changing the mode in xampp from cgi to mod_php, the symbolic link to storage/app/public stopped working in laravel. When I open www.mysite.local/storage , I get into the public/storage folder instead of storage/app/public. Tell me, what could be the matter? How to fix?
Contents of config\filesystem.php:
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
Answer the question
In order to leave comments, you need to log in
In general, who needs the links to storage/app/public to work correctly, you can use this option, taken from here:
Route::get('storage/{filename}', function ($filename)
{
$path = storage_path('app\public\\' . $filename);
if (!File::exists($path)) {
abort(404);
}
$file = File::get($path);
$type = File::mimeType($path);
$response = Response::make($file, 200);
$response->header("Content-Type", $type);
return $response;
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question