John Davidson

php - laravel new routes getting 404 even after cache clear and route clear

0 comments
Message:


I'm running laravel application and recently i have added new api routes in api.php for new functionality


consider below is my route :


Route::get('/testdb', 'Controller@testDb');

when i am trying to run the above api, getting 404 NOT FOUND for all the new routes


I have cleared all the cache and routes.


Here is api.php code


Route::group(['prefix' => 'v1', 'namespace' => 'Api', 'middleware' => 'dbchange'], function () {
Route::get('/testdb', 'Controller@testDb');
}

URL : https://domain/api/v1/testdb


I have tried provided solution available on the stackoverflow but none of them is worked in my case



My Answer:
> Make sure that the controller method `testDb` exists in the `Controller` class and is properly defined.
> Check if the namespace of the controller is correctly specified in the route definition.
> Make sure there are no conflicting routes that might be overriding the new routes.
> Check if the server configuration is correct and the web server is pointing to the correct directory.
> Try running `php artisan route:clear` and `php artisan cache:clear` commands to clear all route and cache data.
> Check if the `.htaccess` file or server configuration is not blocking the new routes.
> Verify that the route is being accessed correctly, for example, `http://yourdomain.com/api/testdb`.
> If none of the above solutions work, try restarting the server or clearing browser cache.

Rate this post

5 of 5 based on 1231 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us