0

I am trying to basic route to controller but this is not working and it says"

Not Found

The requested URL /member/john was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Apache Server at www.something.com Port 80

here is the code in routes.php:

<?php

Route::get('/', function()
{
    //This should return main index page of site
    return 'Hello Khalid';
});


Route::get('member/{name}', 'MemberController@printName');

and this is the controller:

<?php

class MemberController extends BaseController {

    public function index()
    {
        return 'Welcome Mr. John';
    }

    public function printName($name)
    {
        return "Welcome, " . $name;
    }
}

?>

Finally this is the URL am visiting:

http://www.domainName.com/member/john

3
  • Add Route::get('/test', function () { return 'test'; }); to your routes.php and go to domain.tld/test if it doesn't work the routing isn't properly set up Commented Nov 3, 2013 at 15:10
  • Is mod_rewrite activated? Commented Nov 3, 2013 at 15:13
  • that's all what it was. Post an answer and I will approve it. Thanks !!! Commented Nov 3, 2013 at 15:15

2 Answers 2

1

mod_rewrite has to be activated to make routing work under apache.

Sign up to request clarification or add additional context in comments.

Comments

0

Add / to your route.

Route::get('/member/{name}', 'MemberController@printName');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.