Solved

Problem routing with Laravel

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

706 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

19 Experts available now in Live!

Get 1:1 Help Now