Reputation: 2550
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
Upvotes: 0
Views: 487
Reputation:
mod_rewrite
has to be activated to make routing work under apache.
Upvotes: 1
Reputation: 290
Add / to your route.
Route::get('/member/{name}', 'MemberController@printName');
Upvotes: 0