How to make a redirect to a named route
Route::redirect('/foo', '/bar', 301); it works
I want something like Route::redirect('/foo', route('bar'), 301); ideally without callback
How to make a redirect to a named route
Route::redirect('/foo', '/bar', 301); it works
I want something like Route::redirect('/foo', route('bar'), 301); ideally without callback
Route::get('/foo', function(){ return redirect(route('bar'), 301); // Или // return redirect()->route('bar', 301); }); Unfortunately, caching of routs does not work with callbacks, so it is advisable to create a controller, for example, RedirectsController and transfer callbacks to it.
Although in theory, the routs are not yet loaded and there is no way ((((
Source: https://ru.stackoverflow.com/questions/941762/
All Articles