Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

master_chief's avatar

404 Not Found - But Route Exists

Hi everyone. I got a very strange problem with laravel. I get a 404 Not found when a specific url is requested. I have an entire website working on-line, every route works fine except this one

Route::get('modifica_pagamenti/{codice_fiscale}/{stagione_sportiva}','PagamentiController@modifica_pagamenti')->where('stagione_sportiva', '(.*)');

NOTE: I'm Italian, so some specific names are in Italian but I don't think that this is a problem :)

Using the online website I get this message

"Not Found The requested URL /modifica_pagamenti/gzzncl94e13l781o/2016/2017 was not found on this server."

The other routes are ok and when I develop on localhost this route works and it gives me the right View with data I need. The method on my "PagamentiController" is defined

public function modifica_pagamenti($codice_fiscale,$stagione_sportiva){
    //My code here
}

I really don't know how to solve this. If someone could help me I would really appreciate that. If any other information is required, just ask and I'll answer :) Thanks for all.

0 likes
15 replies
sherwinmdev's avatar

modifica_pagamenti/{codice_fiscale}/{stagione_sportiva}

this tells me it's expecting 2 arguments

  • codice_fiscale
  • stagione_sportiva

/modifica_pagamenti/gzzncl94e13l781o/2016/2017

this tells me that

  • codice_fiscale = gzzncl94e13l781o
  • stagione_sportiva = 2016

it's probably giving an error because 2017 is unexpected

master_chief's avatar

Hi, i added the where clause on route that says "catch all you get as second parameter". This works even if theres a '/' in the URL because in blade i use url_encode of that value. In localhost everything works fine!

mdecooman's avatar

Just some thoughts:

What are your other routes? Did you check you do not "conflict" with a route above this one?

If working in local but not in prod. Did you clear your caches before deploying?

master_chief's avatar

@mdecooman other routes are the rest of urls, but the following are related to my controller

Route::get('check_pagamenti','PagamentiController@check_pagamenti');
    Route::resource('pagamenti','PagamentiController');
    Route::get('storico_pagamenti','PagamentiController@storico_pagamenti');
    Route::get('modifica_pagamenti/{codice_fiscale}/{stagione_sportiva}','PagamentiController@modifica_pagamenti')
        ->where('stagione_sportiva', '(.*)');
    Route::patch('aggiorna_storico/{codice_fiscale}/{stagione_sportiva}','PagamentiController@aggiorna_storico')
        ->where('stagione_sportiva', '(.*)');
    Route::get('search_for_payment','PagamentiController@search_payment');
    Route::get('search_athletes_for_payment','PagamentiController@search_athletes');
    Route::get('find_payment_by_team','PagamentiController@search_payment_by_team');

My "not found" route doesn't conflict to others because the first piece of route is unique in my website.

I don't think I cleaned caches... I have to check!

@WebDo my route is in route:list

        | GET|HEAD  | modifica_pagamenti/{codice_fiscale}/{stagione_sportiva} |                             | App\Http\Controllers\PagamentiController@modifica_pagamenti               | web,auth  
Christoforos's avatar

I am having the same issue. I have cleared the cache and my route is in the route list. Did you find any solution ?

newtoncarvalho's avatar

I was having the same problem here. Moving "Route :: Resource" to the end of the route statements solved the problem. It seems that the route generator is conflicting with the routes of the same controller created after it

5 likes
AhmedElGohary's avatar

Hello my mate , i still can't catch how could i solve this my code as the following

Route::get('/ِabout','AdminController@About'); Route::get('/Test','AdminController@Test');

Test is working and it passed me to some view and About returns 404 not found so if you please could you clarify more regarding sorting this out

ajithlal's avatar

run php artisan route:list and check the /about route is listed or not.

siangboon's avatar

one problem in one thread... better open another thread for your own problem instead of hijack others....

siangboon's avatar

the route sequence does matter beside case sensitivity, if you have same prefix route path with multiple number of parameter options, the more number parameters route should put on the higher position then follow by the lesser one...

1 like
kvlet's avatar

My fried you absolute right!!! i have the same problem because I violated the route sequence. when i just placed on right order the route works fine. Thank you very much.

1 like
HashmatWaziri's avatar

Hello! I also encountered this problem before. Please check your Apache's httpd.conf file. Make sure that you enabled the LoadModule rewrite_module modules/mod_rewrite.so by removing the # from the start line of the code.

And also change inside the httpd.conf from Require all denied to Require all granted, AllowOverride All, and Options Indexes FollowSymLinks

Like This: Capture

Please or to participate in this conversation.