MahmoudAdelAli's avatar

404 Error route with same name but different prefix

Hi , i have route group with prefix , with route called helpers

Route::group(['prefix' => 'clients', 'as' => 'clients.'], function () {
Route::get('/helpers', [HelperController::class, 'index'])->name('control.helpers');
#etc ...

and another route group with different prefix with same route link and name

Route::group(['prefix' => 'files', 'as' => 'files.', 'controller'], function () {
	Route::get('/helpers', [FileController::class, 'helpers'])->name('manage.helpers');

when i access the first one it's be like

/clients/helpers

the second one

/files/helpers

when i access first one i got 404 error until i change the link , but here is link must be correct /helpers at files and client , so how i can solve it ? i need all two links with same schema

0 likes
5 replies
MahmoudAdelAli's avatar

@vincent15000 After i change the name's it's same error , the problem not with name , but the same url even the url at browser different.

1 like
ranto's avatar

Sometimes, when you create new routes, you need to run php artisan route:cache to register the new routes.

Check if running that artisan command helps 👀

1 like
vincent15000's avatar

@ranto That's right, but it's not recommended to cache anything in development mode.

1 like

Please or to participate in this conversation.