NarayanChakraborty's avatar

Route is not working except root path

I am using Laravel 5.3 . Route Class only works for root path. Route::get('/',function (){ return "Hello"; }); When i try to execute such as Route::get('/about',function (){ return "Hello"; }); it does not work. Every time it shows me... Sorry, the page you are looking for could not be found. 1/1 NotFoundHttpException in RouteCollection.php line 161:

0 likes
6 replies
king's avatar

Did you cache your routes? That could be a reason.

Snapey's avatar

Do you have your public folder as the document root ?

Or do you see /public/ in your URLs ?

1 like
NarayanChakraborty's avatar

Actually i am trying to make a blog. But i can not work with my controller throw route. Please see my code (master.blade.php for url hit, web.php, and my controller: WelcomeController). I also try to check either it works for normal route which i have told in the above post, it does not work.

https://github.com/NarayanChakraborty/myblog/blob/master/resources/views/master.blade.php

https://github.com/NarayanChakraborty/myblog/blob/master/routes/web.php

https://github.com/NarayanChakraborty/myblog/blob/master/app/Http/Controllers/WelcomeController.php

NarayanChakraborty's avatar

Thanks everyone... I have solved the problem. 1st Formula: I have changed the localhost address for my project. Throw "php -S localhost -t public" 2nd Formula: I have uninstall my photoshop sfotware and remove all contents from hosts file. Now my project works fine with the public folder.

Please or to participate in this conversation.