Frage

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

War es hilfreich?

Lösung

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

Andere Tipps

Add / to your route.

Route::get('/member/{name}', 'MemberController@printName');
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top