1

I'm using laravel 4.2. I would likes to get clean url for my website using .htaccess.I already removed 'public' folder of laravel and it works fine.But when i try to modify some other url it do not works. my url is http://localhost/vote/singlevote/candidate-name. I wants to modify it as http://localhost/vote/candidate-name which should redirect to my siglevote page with corresponding candidate name.

My .htaccess code is

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^index.php/singlevote/(.*)$ $1

i'm not sure it is correct.i'm just a beginner in using .htaccess.

Vishal
  • 552
  • 1
  • 6
  • 20
  • Check this answer, may be helpful to you - http://stackoverflow.com/questions/18973058/how-to-remove-folder-name-from-url-using-htaccess – Kamal Joshi Nov 25 '15 at 06:56
  • I suggest you make use of laravel's routing class. Read more about it [here](http://laravel.com/docs/5.1/routing). – Tweetie Sabado Nov 25 '15 at 07:04
  • Actaully i don't get any idea of how to use that routing class. so i try .htaccess. – Vishal Nov 25 '15 at 07:06
  • first, you don't need to have more than one `RewriteEngine on` definition per one file. Just leave one before your Rewrite rules. Second, add `[L]` to your last RewriteRule – Sergio Ivanuzzo Nov 25 '15 at 07:46

1 Answers1

1

Why you want to do this via .htaccess. In my opinion you should use laravel routing to make seo url/clean urls.

Please follow below url hope it will help you : http://laravel.com/docs/4.2/routing

Ravindra Bhalothia
  • 1,720
  • 2
  • 13
  • 16