0
votes

I am new to laravel. I m following the basic task list project. When I m adding a task, I m getting the following error.

The requested URL /quickstart/public/task was not found on this server.

My route for adding a task is:

Route::post('/task', function(Request $request){
    $validator = Validator::make($request->all(), ['name' => 'required|max:255',]);

    if($validator->fails()){
        return redirect('/')
        ->withInput()
        ->withErrors($validator);
    }

    $task = new Task;
    $task->name = $request->name;
    $task->save();
    return redirect('/');
});

Please help

1
Posted the proper solution here - Rakesh Mali

1 Answers

0
votes

You're using web server with wrong configuration. You should point your web server (Apache or Nginx) to a public directory inside Laravel roo directory and then you should use URLs like this:

/task

instead of this:

/quickstart/public/task

For Apache's httpd.conf configuration file you can use settings like these:

DocumentRoot "/user/htdocs/public"
<Directory "/user/htdocs/public">

Don't forget to reboot web server after that.