jeudi 21 mars 2019

Laravel url return 404 but route exist, if renamed the route works

I have a project where I am merging an update with new Controllers and Routes.

The routes are looking like this accessibility-map/{accessibility_map} and there is API and WEB routes.

All the other routes (previous ones) are working fine but the new one doesn't work.

Here a simplified one that query only the index method of the controller : Route::get('accessibility-map/{accessibility_map}', 'AccessibilitySheet\AccessibilityMapController@index')->name('accessibility-map.recto');

I tried to move the controller outside of the AccessibilitySheet folder, tried to remove all the other methods and include that could generate an error with no luck.

The url is showing with the command php artisan route:list

GET|HEAD  
| accessibility-map/{accessibility_map}                                                   
| accessibility-map.recto                | App\Http\Controllers\AccessibilitySheet\AccessibilityMapController@index                   
| web,localeSessionRedirect,localizationRedirect,localeViewPath

When I change the url to something like test/{test} it's working fine.

I tried the following step to try to break any cache or generated file that could make that specific url to return 404.

  • remove /vendor & composer install
  • composer dump-autoload
  • php artisan route:clear
  • php artisan cache:clear
  • php artisan view:clear (at that point I try everything)
  • I commented the API routes to be sure no one could rewrite the web ones and since not using the /api prefix could return 404 error.

Some more possibility of error that I checked : - It a simple GET request and the route is for get - there's no folder named accessibility-map in the public folder - Restarted the Homestead virtual server - I use the Mcamara\LaravelLocalization static translation package but it's well configured and working for all the others pages.

At that point I don't know what to do to try to fix this since the returned error is a standard 404 error with no more info to dig.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire