Question

I have just set up a new laravel 4 project and I can't seem to get my routes to work.

I have the following code in my routes.php file.

Route::get('test', function()
{
    return 'test';
}); 

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

But if I go to localhost:8888/laravel4 I get a directory listing instead of the '/' route.

If I go to localhost:8888/laravel4/test I get The requested URL /laravel4/test was not found on this server.

I am using MAMP with php 5.5.3 for my localhost.

Was it helpful?

Solution

The entry point is in the public directory

So you go to localhost:8888/laravel4/public/ to get the / route and localhost:8888/laravel4/public/test to the test route.

Otherwise, you should set up a vhost (Don't know how to do in Mac) and point it to the public directory of your laravel project

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top