0

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

Burhan Khalid
  • 169,990
  • 18
  • 245
  • 284
Subhash
  • 21
  • 1
  • 6
  • Posted the proper solution [here](http://stackoverflow.com/questions/35248223/laravel-5-2-quickstart-guide-gives-not-found-error/40993429#40993429) – Rakesh Mali Dec 06 '16 at 11:56

1 Answers1

0

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.

Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279
  • where is httpd.conf file? My local root directiry is /var/www/html – Subhash May 08 '16 at 04:45
  • It really depends on a distro you use. Try to run `httpd -v` command, it should show you a pass to config file. – Alexey Mezenin May 08 '16 at 05:02
  • after running the httpd -v I got followingsubhash@subhash-Lenovo-G50-80:~$ httpd -v No command 'httpd' found, did you mean: Command 'http' from package 'httpie' (universe) Command 'https' from package 'httpie' (universe) Command 'xttpd' from package 'xtide' (universe) httpd: command not found – Subhash May 08 '16 at 05:06
  • Try to find it with a `find` command http://stackoverflow.com/questions/3786606/find-all-files-matching-name-on-linux-system-and-search-with-them-for-text – Alexey Mezenin May 08 '16 at 05:09