0

I am new in Laravel (v4.0.5) and according the website http://laravel.com/docs/routing and other book I found, make a route its as easy as this

Route::any('foo', function()
{
    return 'Hello World';
});

so, I try at my host

http//myhost/public/foo

(and I have to use /public due if i only enter to my host directly where is the folder, I see the structure of the framework... anybody know why is that?)

But I get not found

I've tried

Route::any('user','UserController@index');

I have created my controller like this

<?php

class UsersController extends BaseController {

    public function showWelcome()
    {
        return View::make('users');
    }

    public function getIndex() 
    {
        return View::make('users');
    }
} 

And tried with /users but nothing...

Any idea what I'm doing wrong?

4

2 回答 2

2

Try going here:

http://myhost/public/index.php/foo

You will need to setup URL rewrites if you want it to work with

http://myhost/public/foo

http://httpd.apache.org/docs/current/mod/mod_rewrite.html

于 2013-06-18T19:07:31.123 回答
1

You should point the web root of your server to the public folder. If you're using Apache, you can change this on the httpd.conf file, looking for DocumentRoot setting. Example:

DocumentRoot "C:\Users\Raphael\Documents\GitHub\RaphStore\public"

This is important because it makes sure no one has access to your project files, as it should be.

于 2013-06-18T19:03:13.423 回答