Laravel无法加载除家(/)以外的其他URL?

时间:2013-10-17 18:36:10

标签: php routing laravel http-status-code-404

我安装了laravel并在localhost/laravel/public上获取主页。 但无法做简单的路由。

Route::get('/', function()
{
    return View::make('hello');
});

Route::get('authors',function()
{
    return View::make('hello');
});

我在localhost/laravel/public/authors打电话给同一个观点。 但我得到了404.

我有一个不同的观点,也是/但不是authors

Route::get('/', function()
{
    return View::make('authors');
});

Route::get('authors',function()
{
    return View::make('authors');
});

现在,我正在/上查看作者,但不会使用authors

由于

1 个答案:

答案 0 :(得分:1)

如果您能够访问/laravel/public/index.php/authors,那么您需要在RewriteBase文件中添加.htaccess,即假设您正在运行Apache:

RewriteEngine on
RewriteBase /laravel/public
<other rules go here>
相关问题