i am new to laravel world
i have downloaded an existing project
i have added the needed logic in a new controller and added the route for that controller to web.php
after that i tried to access the page but i was getting error 404
i thought it was something wrong with my controller so i have used the existing controller logic in my new route
i have restarted apache, mysql, laragon but still getting 404
the new route it almost like the existing one just copy past and added a character but still the old route works but not the new one
i am using laravel 9 with laragon
any advise ??
i have tried to restart laragon but it didnt work
You have too run:
php artisan route:clear
php artisan cache:clear
Related
im new in laravel so im just try to run laravel without php artisan and read much topics about run laravel without php artisan but the main problem is the main route (/) is working and run (home view) but other routes like (/about) in web file doesnt work. so how can i run other views via routes (web file)?? i tried many ways for run laravel without php artisan but im stuck in this part routes. without routes, laravel is completely useless. i moved index.php from public folder and .htaccess to the root folder for run laravel wihout php artisan like this:root folder laravel
and this my index.php so i changed it to run from root not public folder:
index.php file
and .htaccess:
.htacess file
and finally this is my web file which is my routes:
web.php
when i set routes about and try to go to that, the error 404 is shown up: error 404 /about route
so how can i set routes and actualy the main problem is how can i request and Recieve urls from root without php artisan. and another way that i tried is rename server.php to index .php and i could say none of this ways are working. it just show the root home page not working for other routs. thanks
I installed Laravel (in W10/Wamp3.3/PHP5.6) using Composer and created a new project with the following command:
laravel new my_project
Project doesn't have a welcome page, opens file-list directly. So I decided to try my chance on creating a new controller and create a route.
php artisan make:controller Hello
And my route in routes/web
Route::get('/hello', 'HelloController#index');
I also cleared the route cache:
php artisan route:clear
Created the controller with no methods. myproject/hello shows nothing.
What am I missing? File permissions or wamp based problem?
There's a question related with this but it's more like a server problem.
Few causes for this that I've run into. Most likely one is going to be the server pointing to the incorrect directory. What I would do to test is run php artisan serve from the root of the project. This will open up a server pointing to public directory. If this functions correctly then you have confirmation.
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):
resetting the github repo on the server (fresh install)
composer update
php artisan cache:clear
php artisan view:clear
php artisan route:clear
php artisan config:clear
composer dump-autoload
changing the route from authenticate to authenticate-email
What could it be? Every other route on the site works, it is just this one that doesnt.
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() :)
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
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?
I have this issue with homestead where it can't access any of my views instead it tells me NotFoundHttpException in RouteCollection.php line 145: (this is a new project) . When I try accessing an old laravel project which I made it works perfectly fine but when I create a new project it throws me this error. Now I have also tested it with php artisan serve and try accessing this on localhost:8000 and this works without problems. so why does homestead have problems?
NotFoundHttpException is actually thrown when there was no matching route found.
Seeing how it's working fine using artisan serve I think you should have a look wether the 'app' is setup properly in the Homestead configuration.
You can find more info on that here: https://laravel.com/docs/5.2/homestead#adding-additional-sites
In blade use url() funtion to route
for example
<a href='login'>test</a>
to
<a href='{{url("login")}}'>test</a>
And make sure that mod_rewrite in enable
I did look at the other Laravel Route questions, but nothing seems to work for me.
I am trying Laravel 4. I ran the command:
php artisan controller:make PhotoController
to create my controller. Then I added a route in my routes.php file as such:
Route::resource('photo', 'PhotoController');
When I go to localhost/photo, I see 404 Not Found.
Any ideas? I can see the root and /index.php, they both say "Hello World", so I know something is working.
You might need to run
composer dumpautoload
from the command line, so laravel knows the controller is there.
you can also try this:
php artisan dump-autoload