进入另一条路线=> 404找不到apache,laravel 5.4

时间:2017-04-06 22:46:01

标签: php apache laravel-5.4

我刚刚设置了我的作曲家并安装了一个新的laravel 5.4项目,我为apache服务器设置了一个虚拟主机。

虚拟主机配置

Te virtual host configuration

主机文件:

enter image description here

新申请的主页laravel.app正常工作
但是当我添加一个新视图并为其设置路径时,例如:

//This is The default Home page route
Route::get('/', function () {
    return view('welcome');
});
// This is the new Route
Route::get('/hello',function(){
    return view('hello'); // I created another view with the name hello.blade.php  

});


当我尝试使用链接laravel.app/hello访问它时,我收到此错误:

  

未找到

     

在此服务器上找不到请求的URL / hello。阿帕奇/ 2.4.18   (Ubuntu)服务器在laravel.app端口80

我想提一下我的操作系统是Ubuntu 16.04

1 个答案:

答案 0 :(得分:0)

首先检查是否启用mod_rewrite。使用this question's answer

第二次将.htaccess文件放在.../public中,其中包含以下内容:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

结帐reference