我使用 Composer 安装了 Laravel 4,并设置了虚拟主机。目前,只有根路由有效:
<?php
Route::get('/', function()
{
return View::make('hello');
});
这不是:
Route::get('/hello', function()
{
return View::make('hello');
});
我想要点击的是 /tasks
处的 TasksController
:
Route::resource('tasks', 'TasksController');
这也给了我 404 错误。我可能做错了什么?我的项目根目录有一个默认的 .htaccess 文件:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
我在 Mac 上使用 localhost。
最佳答案
只是为了一笑,看看 /index.php/hello
是否有效。
如果是这样,那么很可能是 .htaccess
问题。
关于Laravel 4 除了 Home 之外的所有路由都会导致 404 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13514990/