2017-06-05 121 views
0

我正在运行的XAMPP laravel和我有问题,访问的网页, http://localhost/laravel/public/我得到一个登录页面,这是很好 但是当我去例如http://localhost/laravel/public/smokeyardXAMPP本地主机不工作

我得到404误差The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

路线:

Route::get('smokeyard', '[email protected]'); 

控制器:

function smokeyard(){ 
    return view('smokeyard'); 
} 

我的所有视图都位于资源文件夹中。

+0

1.检查Apache的mod_rewrite的启用网址。 2.从cmd转到您的项目文件夹。运行--php artisan serve命令并运行你的本地环境http:// localhost:8000 - 你的所有路径都可以运行 3. use:public/index.php/。 –

+0

如果您使用php artisan serve,它仍然使用xampp的mysql模块吗? – Przemek

+0

是的mysql和工匠没有任何连接。 –

回答

3

,如果你不想运行artisan serve访问laravel项目,您需要更改一些设置,

  1. public folderpaste它复制.htaccess文件在你application

  2. root folderrenameserver.phproot directory to index.php

现在去localhost/your_project_name/smokeyard您要检查

希望这有助于

0

运行php artisan serve并访问您的服务器http://localhost:8000。那么你的路线应该工作得很好。

您无法直接通过xampp文件夹结构访问您的laravel应用程序路径。您需要设置web根目录指向public文件夹并访问localhost或运行laravel服务器并使用它。这是因为当你以laravel的方式访问路由时,URL重写会失败。