Xampp localhost not working

此生再无相见时 提交于 2019-12-08 01:17:21

问题


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,

  1. copy the .htaccess file from the public folder and paste it in the root folder of your application

  2. rename the server.php in the root 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!