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

SupunSam's avatar

NotFoundHttpException Error

Hi All,

I am getting the following error from browser console whenever I reloaded my data table page:

message: "", exception: "Symfony\Component\HttpKernel\Exception\NotFoundHttpException",…}
exception: "Symfony\Component\HttpKernel\Exception\NotFoundHttpException"
file: "C:\Users\Supun Samarakoon\Desktop\Laravel Projects\LoginSystem\vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php"
line: 179
message: ""

Any clue what is the reason behind this error. Since I figured this is a route related issue I checked my routes as well. But unable to find a issue there(As per my knowledge. I am a beginner in Laravel).

Routes:

<?php

use Illuminate\Support\Facades\Route;

/*...*/

Route::get('/', function () {
    return view('auth/login');
});

Auth::routes();

Route::group(['middleware' => ['auth.roles']], function () {
    /*Side bar menu Routes*/
    Route::get('/home', 'HomeController@index')->name('home');
    Route::get('/dashboard', 'HomeController@dashb')->name('dashboard');
    Route::get('/profile', 'HomeController@profile')->name('profile');

    /*Activity Sub Routes*/
    Route::get('/jobEditCancel', 'JobController@jobEditCancel')->name('jobEditCancel');
    Route::get('/jobAddCancel', 'JobController@jobAddCancel')->name('jobAddCancel');

    /*Activity Resource Routes*/
    Route::resource('/activity', 'JobController');

    // Route::get('/activity', 'JobController@index')->name('activity.index');
    // Route::delete('/activity/destroy/{id}', 'JobController@destroy')->name('activity.destroy');

    /*FPBlog Routes*/
    Route::resource('fpblog', 'PostController');
    Route::get('/postEditCancel', 'PostController@postEditCancel')->name('postEditCancel');
    Route::get('/blogManager', 'PostController@blogManager')->name('blogManager');
});

// Admin Tools
Route::namespace('Admin')->prefix('superadmin')->middleware(['auth', 'auth.admin'])->name('admin.')->group(function () {
    Route::resource('users', 'UserController', ['except' => ['show', 'create', 'store']]);
    Route::get('/impersonate/user/{id}', 'ImpersonateController@index')->name('impersonate');
});

Route::get('/admin/impersonate/destroy', 'Admin\ImpersonateController@destroy')->name('admin.impersonate.destroy');

Can anyone kindly help me with this?

0 likes
20 replies
muhi's avatar

Hi. The error message doesn't indicate which route you tried to access. Kindly post the datatable route logic.

munazzil's avatar

Can you try below code in your command prompt?,

     php artisan route:list
1 like
SupunSam's avatar

Hi @munazzil .. Yes of course.

ET|HEAD  | /                                |                           | Closure                                                                | web                 |
|        | GET|HEAD  | activity                         | activity.index            | App\Http\Controllers\JobController@index                               | web,auth.roles      |
|        | POST      | activity                         | activity.store            | App\Http\Controllers\JobController@store                               | web,auth.roles      |
|        | GET|HEAD  | activity/create                  | activity.create           | App\Http\Controllers\JobController@create                              | web,auth.roles      |
|        | DELETE    | activity/{activity}              | activity.destroy          | App\Http\Controllers\JobController@destroy                             | web,auth.roles      |
|        | PUT|PATCH | activity/{activity}              | activity.update           | App\Http\Controllers\JobController@update                              | web,auth.roles      |
|        | GET|HEAD  | activity/{activity}              | activity.show             | App\Http\Controllers\JobController@show                                | web,auth.roles      |
|        | GET|HEAD  | activity/{activity}/edit         | activity.edit             | App\Http\Controllers\JobController@edit                                | web,auth.roles      |
|        | GET|HEAD  | admin/impersonate/destroy        | admin.impersonate.destroy | App\Http\Controllers\Admin\ImpersonateController@destroy               | web                 |
|        | GET|HEAD  | blogManager                      | blogManager               | App\Http\Controllers\PostController@blogManager                        | web,auth.roles      |
|        | GET|HEAD  | dashboard                        | dashboard                 | App\Http\Controllers\HomeController@dashb                              | web,auth.roles,auth |
|        | POST      | fpblog                           | fpblog.store              | App\Http\Controllers\PostController@store                              | web,auth.roles      |
|        | GET|HEAD  | fpblog                           | fpblog.index              | App\Http\Controllers\PostController@index                              | web,auth.roles      |
|        | GET|HEAD  | fpblog/create                    | fpblog.create             | App\Http\Controllers\PostController@create                             | web,auth.roles      |
|        | GET|HEAD  | fpblog/{fpblog}                  | fpblog.show               | App\Http\Controllers\PostController@show                               | web,auth.roles      |
|        | DELETE    | fpblog/{fpblog}                  | fpblog.destroy            | App\Http\Controllers\PostController@destroy                            | web,auth.roles      |
|        | PUT|PATCH | fpblog/{fpblog}                  | fpblog.update             | App\Http\Controllers\PostController@update                             | web,auth.roles      |
|        | GET|HEAD  | fpblog/{fpblog}/edit             | fpblog.edit               | App\Http\Controllers\PostController@edit                               | web,auth.roles      |
|        | GET|HEAD  | home                             | home                      | App\Http\Controllers\HomeController@index                              | web,auth.roles,auth |
|        | GET|HEAD  | jobAddCancel                     | jobAddCancel              | App\Http\Controllers\JobController@jobAddCancel                        | web,auth.roles      |
|        | GET|HEAD  | jobEditCancel                    | jobEditCancel             | App\Http\Controllers\JobController@jobEditCancel                       | web,auth.roles      |
SupunSam's avatar

Hi @muhi...I am calling this from my ajax code for datables.

$('#jobsTable').DataTable({
        dom: "B" + /* Buttons */
        "<'row'<'col-sm-12 col-md-6'l>" + /* Length changing input control */
            "<'col-sm-12 col-md-6'f>>" + /* Filtering Input */
                "<'row'<'col-sm-12'tr>>" + /* The Table! + Processing Display Element*/
                    "<'row'<'col-sm-12 col-md-5'i>" + /* Table Information Summary */
                        "<'col-sm-12 col-md-7'p>>" , /* Pagination Control*/

        processing: true,
        serverSide: true,
        ajax: " {{ route('activity.index') }}",

fichby's avatar

Please post what address eg. "/datatable" that you were trying to access?

SupunSam's avatar

Hi @fichby. I am trying to reload the activity.index route. That's when I get this error.

fichby's avatar

in your dev-tools in the network tab, can you confirm the actual location being requested?

SupunSam's avatar

The biggest issue is after I reload the page several times, It will load properly without any issue. But I get the error almost 95 percent of the time.

SupunSam's avatar

Hi @fichby. Its something like this. This is only a portion of it since this a big table.

activity?draw=2&columns%5B0%5D%5Bdata%5D=
fichby's avatar

If the table is that large, you could be hitting the http get request limit, maybe try using a post.

muhi's avatar

I faced similar issue with datatables before. I ended moving all my datatable routes to the top of the route file. I think its related to wildcard routing but not sure.

1 like
SupunSam's avatar

Hi @fichby. Can you kindly give me some pointers please? I am extremely new to laravel. Really appreciate your help.

1 like
SupunSam's avatar

Hi @muhi. I tried that. But issue remains the same. even though time to time I can load the page I cannot use the data table search option at all. I am truly lost here.

fichby's avatar

@supunsam something like this

"ajax": {
            "url": "scripts/post.php",
            "type": "POST"
        },
1 like
SupunSam's avatar

Hi @fichby. Thanks or your suggestion. But still, it throws the same error here.

fichby's avatar

have you done

php artisan route:clear
1 like
SupunSam's avatar

Is there any maximum column count for data tables. mine is exceeding 60.

fichby's avatar

A NotFoundHttpException exception in Laravel always means that it was not able to find a router for a particular URL

1 like
SupunSam's avatar
SupunSam
OP
Best Answer
Level 1

Thank you each and every one of you who have tried your best to support me to solve this problem. However, after so many searches for the answer, I have figured it out.

Apparently my URI is far too long. Due to the high number of columns. I was able to understand this after moving my development environment to laravel Homestead.

I have followed the steps on this blog to shorten the URL. And it solved all the issues:

https://yajrabox.com/blog/datatables-and-long-url

Once again thank you very much for anyone who has provided their opinion. I hope this post will be useful to someone who is trying to create data tables which have high column counts.

Please or to participate in this conversation.