问题
I am running laravel on xampp and I have problem with accessing pages,
http://localhost/laravel/public/ I get a login page which is good
however when I go for example http://localhost/laravel/public/smokeyard
I get 404 error with The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
Route:
Route::get('smokeyard', 'GuzzleController@smokeyard');
Controller:
function smokeyard(){
return view('smokeyard');
}
All my views are located in resources folder.
回答1:
if you want to access laravel project without running artisan serve, you need to change few settings,
copy the
.htaccessfile from thepublic folderandpasteit in theroot folderof yourapplicationrenametheserver.phpin theroot directory to index.php
now go to localhost/your_project_name/smokeyard for the url you want to check
hope this helps
回答2:
Run php artisan serve and access your server at http://localhost:8000. Your routes should work fine then.
You can't access your laravel application routes straight away through the folder structure with xampp. You need to setup the web root to point to the public folder and access localhost or run the laravel server and use it. This is because the url rewriting would fail when you access the routes in laravel the way you do.
来源:https://stackoverflow.com/questions/44371009/xampp-localhost-not-working