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.

4
  • Check this answer, may be helpful to you - stackoverflow.com/questions/18973058/… Commented Nov 25, 2015 at 6:56
  • I suggest you make use of laravel's routing class. Read more about it here. Commented Nov 25, 2015 at 7:04
  • Actaully i don't get any idea of how to use that routing class. so i try .htaccess. Commented Nov 25, 2015 at 7: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 Commented Nov 25, 2015 at 7:46

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.