ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -
edit: think problem due not setting apache properly, these 2 links helped me.
solution:
http://laravel.io/forum/06-11-2014-not-found-but-route-exists
end edit
i'm following laravel 5.2 quickstart guide. https://laravel.com/docs/5.2/quickstart
i'm running ubuntu 14.04.2
the website runs initially, when click on add task button run 404 not found error.
as per guide run following commands setup complete quickstart project.
git clone https://github.com/laravel/quickstart-basic quickstart cd quickstart composer install php artisan migrate
additionally run following commands because i'm on ubuntu server:
sudo chown -r www-data.www-data quickstart sudo chmod -r 755 quickstart sudo chmod 777 quickstart/storage
the routes.php file looks like:
<?php use app\task; use illuminate\http\request; route::group(['middleware' => ['web']], function () { // route::get('/', function () { $tasks = task::orderby('created_at', 'asc')->get(); return view('tasks', [ 'tasks' => $tasks ]); }); 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('/'); }); // route::delete('/task/{task}', function (task $task) { $task->delete(); return redirect('/'); }); });
i tried changing code in resources/view/tasks.blade.php from:
<!-- new task form --> <form action="/task" method="post" class="form-horizontal">
to location of actual public folder of laravel project :
<!-- new task form --> <form action="/learninglaravel/laraquickstart/quickstart/public/task" method="post" class="form-horizontal">
so problem when press button 404 error
//***** edit:
i have tried having editing post route doesn't fix problem.
route::post('/learninglaravel/laraquickstart/quickstart/public/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('/'); });
the error is:
not found requested url /learninglaravel/laraquickstart/quickstart/public/task not found on server.
instead of:
not found requested url /task not found on server.
i did suggested james , right, makes url change
/learninglaravel/laraquickstart/quickstart/public/task
but still error of page not found. difference error message changed bellow error above. (i tried manually changing both url in route.php file , tasks.blade.php reflect same url. above url both in routes.php , tasks.blade.php
i'm running on ubuntu aws server maybe made mistake on end? think quickstart tutorial written homestead ran problems database.(i had manually create one. guide never specified that. think might pre-configured in homestead automatically use database)
cheers
when change form action parameter to
/learninglaravel/laraquickstart/quickstart/public/task
you going make http post request
{scheme}://{domain}//learninglaravel/laraquickstart/quickstart/public/task
so laravel going route , won't find it.
Comments
Post a Comment