Haring10
Haring10

Reputation: 1557

Laravel 5.2 Only one specific route not found, but it does exist

No matter what I try, the route /authenticate/{code} returns a NotFoundHttpException.

My route in routes.php:

Route::get('/authenticate/{code}', ['as' => 'authenticate', 'uses' => 'FrontendController@getAuthenticate']);

When I am calling the route:

URL::route('authenticate', $code)

On my local machine it runs it just fine, but on my production server, it takes me to a NotFoundHttpException page.

It does site inside of the web middleware group.

I have tried (with no success):

What could it be? Every other route on the site works, it is just this one that doesnt.

Upvotes: 2

Views: 1915

Answers (3)

Rahul
Rahul

Reputation: 11

I also ran into this issue. I deleted the route, then copy another working route and changed the route name and parameters with the one. And It Worked

Upvotes: 1

cshelswell
cshelswell

Reputation: 83

I don't know if you solved this but I just had exactly the same problem, nothing I did would make the route work. It was a really simple route: Route::get('/search', ['middleware' => 'shop_session','uses' => 'Cinder\StoreController@viewProducts']);

Did all the things you did. In the end I moved the route to the top of my routes file, ran php artisan route:cache and it worked.

Not a great answer and I've got no idea why it worked but it did. Maybe worth a try?

Upvotes: 0

dargue3
dargue3

Reputation: 2942

The only thing I can think to advise is switching from using the URL Facade to using the built in helper function $url = route('authenticate', ['code' => $code]); I only say this because I can't seem to find in the docs how you hint at URI parameters when using URL::route() :)

Upvotes: 2

Related Questions