Answer the question
In order to leave comments, you need to log in
How to redirect a request to another route in Laravel+Nginx?
There are files in the storage/app/public folder, access to which should be checked, if the file exists by reference, then nginx immediately gives it away, I tried to write a separate Route::get('storage/{file}') route, but it is naturally ignored .
Question: how can I redirect from storage / file_name to any route in Laravel for further processing of the request?
I tried in nginx config to do
location /storage/ {
rewrite ^/storage/(.*) /index.php?путь break;
}
Answer the question
In order to leave comments, you need to log in
Solved the problem by adding to the location config
location /storage/ {
rewrite .* /index.php;
}
Route::get('storage/{file}', function ($file) {
//
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question