Solved

Problem routing with Laravel

Posted on 2014-09-26
3
187 Views
Last Modified: 2014-10-03
Hello

I 'think' I have successfully installed Laravel using 2 different internet guides. Here is one one of them

http://phpraxis.wordpress.com/2014/07/04/getting-started-with-laravel-4-on-ubuntu-installation-and-configuration/

I have managed to get the include laravel test page "You have arrived"

I am now unable to add an additional route. This is what i did in the routes.php file



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


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

Open in new window

If i add a page foo or foo.php I get the error

Not Found

The requested URL /foo was not found on this server.

I can alter the code in the default view

However if i do something like this

Route::get('/', function()
{
        return 'Hello Andrea';
});
everything is fine

I'm confused. I dont think I get Laravel views. how would i fix this to work as a first step on my jourmey

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

Some guides also suggested putting Laravel in the home folder e.g. /home/username/laravel and whan i tried this I couldnt even get the 'you have arrived page'

I thought Laravel had a shallow learning curve? It must be me.

Thanks for any help
0
Comment
Question by:andieje
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
Lukasz Chmielewski earned 500 total points
ID: 40348515
Hi.
You do not have to put the file foo.php inside the folder, as a matter of fact in this case you don't need to have it at all.
If you want to check if the route works, just enter
http://yoursite/foo
then you should see the "Hello Andrea" text displayed. Did you try to do that ?
0
 

Author Comment

by:andieje
ID: 40351915
Ill double check - its on a differnet machine
0
 

Author Comment

by:andieje
ID: 40351916
will close quesion tonight if that is correct
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question