php - Laravel 5 pretty URL not working on wamp -
i new laravel, working on small project, using wamp. facing problem pretty url part, figured out now.
but getting weird issue. have created application under directory laravel-first-app. when trying request page (articles) example, http://localhost/laravel-first-app/public/index.php/cv, showing page.
but if, request page example, http://localhost/laravel-first-app/public/cv, saying url not found error.
below brief description did.
in routes.php
route::get('/', 'welcomecontroller@index'); route::controllers([ 'auth' => 'auth\authcontroller', 'password' => 'auth\passwordcontroller', ]); route::resource('articles','articlescontroller'); route::get('articles/delete/{article_id}','articlescontroller@destroy'); route::get('cv','cvcontroller@index'); route::get('cv/upload','cvcontroller@upload'); route::post('cv','cvcontroller@store');
in cvcontroller
<?php namespace app\http\controllers; use app\http\requests; use app\http\controllers\controller; use illuminate\http\request; use illuminate\support\facades\input; class cvcontroller extends controller { private $pathtocv; private $filename; public function __construct() { $this->pathtocv="cv/"; $this->filename='piyush_cv.doc'; } /** * display listing of resource. * * @return response */ public function index() { return response()->download($this->pathtocv.$this->filename); } /** * show form creating new resource. * * @return response */ public function upload() { return view('cv.upload'); } /** * store newly created resource in storage. * * @return response */ public function store(request $request) { dd($request); if($request->hasfile('cv')) { $file = $request->file('cv'); $file->move($this->pathtocv,$this->filename); flash()->overlay('file uploaded','thanks uploading file'); return redirect('cv/upload'); } flash()->overlay('file not selected',''); return redirect('cv/upload'); } }
in .htaccess have:
<ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on # redirect trailing slashes... rewriterule ^(.*)/$ /$1 [l,r=301] # handle front controller... rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l] </ifmodule>
also, wamp, have enabled mod_rewrite module.
can please me out this? want use url http://localhost/laravel-first-app/public/cv instead of http://localhost/laravel-first-app/public/index.php/cv
please help.
go project folder, open terminal , run php artisan serve
start localhost:8000 or similar go https://localhost:8000/articles
required page
Comments
Post a Comment