Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
314 views
in Technique[技术] by (71.8m points)

Laravel 4 All Routes Except Home Result in 404 Error

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');
});

This is not:

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

What I'm trying to hit is TasksController at /tasks:

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

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>

I am using localhost on a Mac.

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...