Level 104
How have you defined the Laravel catch all route?
The following should do it for you:
Route::get({any}, function () {
return view('index'); // or wherever your React app is bootstrapped.
})->where('any', '.*');
2 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am using the React preset that comes along with Laravel: php artisan preset react and I seem to be having problems with it concerning routing with React. Every time I specify a /somewhere everything works fine but when I specify one route deeper /somewhere/one-level-deep it gives the 404 page. Anyone have any idea what is wrong? I tried with create-react-app and it works fine.
How have you defined the Laravel catch all route?
The following should do it for you:
Route::get({any}, function () {
return view('index'); // or wherever your React app is bootstrapped.
})->where('any', '.*');
Please or to participate in this conversation.