Solved

Problem routing with Laravel

Posted on 2014-09-26
3
184 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

New My Cloud Pro Series - organize everything!

With space to keep virtually everything, the My Cloud Pro Series offers your team the network storage to edit, save and share production files from anywhere with an internet connection. Compatible with both Mac and PC, you're able to protect your content regardless of OS.

Question has a verified solution.

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

Suggested Solutions

This article discusses how to create an extensible mechanism for linked drop downs.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now