404 - NOT FOUND in laravel 8 - laravel

I'm new to laravel and I've just installed the package on a local server.
I used php artisan serve to open the app
I made a simple route to test:
Route::get('a', function () {
return 'hi there';
});
but when I try to open this route I got 404 not found.

Related

having issues with laravel 9 breeze , i have hosted it successfully everything working fine ... but breeze login and register wont work on production

this is my error on production level
Vite manifest not found at: /home/codarhqc/codar/public/build/manifest.json (View: /home/codarhqc/codar/resources/views/layouts/guest.blade.php) (View: /home/codarhqc/codar/resources/views/layouts/guest.blade.php)
You can delete the following file bootstrap/cache/config.php or better if you can make a route in your web.php file with a function that runs: php artisan optimize:clear.
This should remove the problem.

Some URLs are 404 in production

I have a Laravel 7 project that I deploy using Deployer and everything works as expected. A few days later, I created a new route, /privacy-policy. I also created a controller and a Blade template. Everything seemed to be working great. However, upon deployment, surprisingly there was a 404 error. All the other links are working fine.
Route
Route::get('/home', 'HomeController#index')->name('home');
Route::get('/privacy-policy', 'HomeController#privacy');
Controller
public function privacy()
{
return view('app.privacy-policy');
}
Even a closure doesn't work.
Route::get('/', function () {
return view('app.privacy-policy');
});
I ran the following commands, but it didn't help.
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan config:cache
Why don't you run php artisan route:list so that you can verify the URI and name are actually correct? For instance if you see 'app.privacy-policy' in the URI column then verify that it's named that and also in your controller. Basically fix your route.
Route::get('app.privacy-policy', 'HomeController#privacy')
->name('app.privacy-policy');
public function privacy()
{
return view('app.privacy-policy');
}

My laravel 5.4 not identify the new route i added

I have uploaded a site to cpanel and after some days i added a new route and now the site cannot identity the new route..and when i check php artisan route:list, i cant find it on the list
below are the new route i just added...both of them says page cannot be found..i have try to clear cache still i get same error
Route::get('foo', function () {
return 'Hello World';
});
Route::get('/buycabletv', 'WalletController#buycabletv')->name('name.buycbl');
php artisan cache:clear
php artisan route:cache
this fixed it for me..

NotFoundHttpException in RouteCollection.php in laravel 5.4

I created a new project via composer create-project laravel/laravel Test 5.4.* then i go to my browser to see my localhost if its working localhost/test/public and it works it redirect me to the welcome page, but when i tried to test
Route::get('/test', function(){
return 'TEST';
});
Then I go to my localhost/test/public/test it shows me error like
NotFoundHttpException: in RouteCollection.php (line 179)
is it a solved issue?
instead of localhost/test/public/test try localhost/test/public/index.php/test.
of course you can use laravel's own server. it is suitable for most developing usages.

Laravel 5.4 php artisan route:list showing incorrect data after a route:clear

I have the following issue. I am running laravel 5.4 and have a problem with my routes, when I navigate to my '/about-me' of my predefined routes I get the error:
1/1 NotFoundHttpException in RouteCollection.php line 179:
However the route is defined as shows here:
Route::get('about-me', function () {
return view('about-me');
});
On my view the link is pointing to that route as shown:
About Me
I have cleared my cached routes in SSH using the command:
php artisan route:clear
When I list my routes using the command:
`php artisan route:list`
I see an old version of my routes file. So this is the problem, however whatever I try they are not updating. I have cleared the cache locally and within laravel and still the old file file is showing when I type the route:list command.
I believe the code is all correct, however the new updated route file which contains the defined route for about-me is not being used. I have attached an image of the updated routes file on the server also.
Here is a link to the screenshot. Screenshot of route file on server
Thanks
In Laravel 5.4 (or in earlier version, I'm not sure) routes has been moved to the separate folder in app/routes/web.php (as you can see here: https://github.com/laravel/laravel).
You can find routes registration in app/Providers/RouteServiceProvider.php (https://github.com/laravel/laravel/blob/master/app/Providers/RouteServiceProvider.php#L52)

Resources