jpganz18
jpganz18

Reputation: 5858

How to: make my routes start working with Laravel 4?

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?

Upvotes: 0

Views: 825

Answers (2)

William Byrne
William Byrne

Reputation: 506

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

Upvotes: 2

rmobis
rmobis

Reputation: 27002

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.

Upvotes: 1

Related Questions