Laravel 4除原始结果外的所有路线均出现404错误 [英] Laravel 4 All Routes Except Home Result in 404 Error

查看:63
本文介绍了Laravel 4除原始结果外的所有路线均出现404错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Composer安装了Laravel 4,还设置了一个虚拟主机.当前,只有根路由有效:

I installed Laravel 4 using Composer and also set up a virtual host. Currently, only the root route is working:

<?php

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

这不是:

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

我要打的是/tasks上的TasksController:

Route::resource('tasks', 'TasksController');

这也给我404错误.我可能做错了什么?我在项目的根目录下有一个默认的.htaccess文件:

This is giving me 404 error as well. What could I be doing wrong? I have a default .htaccess file at the root of my project:

<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

我在Mac上使用本地主机.

I am using localhost on a Mac.

推荐答案

只是笑一下,看看/index.php/hello是否有效.

Just for a laugh, see if /index.php/hello works.

如果是这样,那么很可能是一个.htaccess问题.

If so, then most likely it's a .htaccess problem.

这篇关于Laravel 4除原始结果外的所有路线均出现404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆