Solved

Problem routing with Laravel

Posted on 2014-09-26
3
201 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
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 viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

705 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