laravel 5.6 all route except index says page not found on wamp php7.1.9

Published 4 months ago by evilprogrammer

My web.php file contains

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

Route::get('/foo', '[email protected]'); Route::get('/bar', '[email protected]');

Both @foodie and @barbie exists and should return

dd("Hi i worked")

But surprisingly it does not recognize any other route except the default "/" on wamp but it works when using php artisan serve. I also found a post on stack where someone complained the same thing but no solution yet. Every other laravel project works fine on my wamp but laravel new 5.6 does not.

Best Answer (As Selected By evilprogrammer)
jdunsmore

@evilprogrammer I assume the "app" part of your URL is the folder that your app files are within?

Yeah a virtual host domain would work, or you can edit the default directory for wamp and point that to the public folder of app.

Only issue with the second option above is that if you have other projects on you would need to change that everytime.

ahmeddabak

What error message do you get when you try to visit /foo in the browser?

evilprogrammer

@ahmeddabak a white page saying: Sorry, the page you are looking for could not be found.

lostdreamer_nl

if you run

php artisan route:list

do you see the routes there?

You can also run

php artisan route:clear

to clear any cached routes file.

evilprogrammer

@lostdreamer_nl yes I have done both but still the same, I really don't understand why it works on php artisan serve but not on wamp.

i am still trying to find the error.

jdunsmore

@evilprogrammer

Are you pointing the Wamp path to the public folder of the Lara app or are you doing :

http://localhost/public

If you are doing the above, then it wont be actually loading the app properly.

evilprogrammer

@jdunsmore kinda, am accessing from http://localhost/app/public/foo, do you mean I should use a virtual host domain like link??

jdunsmore

@evilprogrammer I assume the "app" part of your URL is the folder that your app files are within?

Yeah a virtual host domain would work, or you can edit the default directory for wamp and point that to the public folder of app.

Only issue with the second option above is that if you have other projects on you would need to change that everytime.

evilprogrammer

@jdunsmore Thank you so much that works, but does this mean that my other projects without virtual hosts are not safe to upgrade? i can't imagine having virtual hosts for about 55 laravel projects

jdunsmore

@evilprogrammer I would probably go down the route of changing the default directory, then all you need to do is just change that path for each project your working on. I mean, you can only work on one at a time anyway?

evilprogrammer

@jdunsmore yeah true but sometimes one app connects to the other. but the virtual host method is not bad either. Thank you

jdunsmore

Very true.

No problem at all.

beatus

@evilprogrammer how did you solve the problem? I am having same issue, i have virtual host setup but not working

Please sign in or create an account to participate in this conversation.