7

I am implementing Slim Framework for PHP and everything appears to be working just fine. However, the only way I can get it to work is by putting /index.php in the URL like this:

http://www.example.com/index.php/members/1

I want it to work like this:

http://www.example.com/members/1

I have a feeling it has something to do with my .htaccess but I'm not sure. Here is my .htaccess:

RewriteCond %{REQUEST_FILENAME} !-f
# RewriteRule ^ ./index.php [QSA,L]
RewriteRule ^ . [QSA,L]
kapa
  • 77,694
  • 21
  • 158
  • 175
Progger
  • 2,266
  • 4
  • 27
  • 51

3 Answers3

5

Restoring the commented (#) line and getting rid of the other one should help. When you downloaded Slim Framework, it originally had this in the .htaccess as well.

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

Also, you should learn about writing rewrite rules, because you won't get far without it.

kapa
  • 77,694
  • 21
  • 158
  • 175
  • Thanks, @bazmegakapa. That is what I originally had in my .htaccess but it still doesn't seem to work. I have a feeling my Rewrite Engine might not be on. I am trying to tshoot this right now. – Progger Jul 19 '12 at 21:30
4

I think this answer comes late, but following the information of this link http://docs.slimframework.com/routing/rewrite/
What I needed was to add the AllowOverride All statement to my virtual host configuration, and that worked for me.

Martin Burch
  • 2,726
  • 4
  • 31
  • 59
  • Didn't come late at all, it helped me... i totally forgot to configure that feature in my new server ;) Thanks! – Andres SK Aug 28 '13 at 17:36
0

Check your virtual host and allowOverRide all.

   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^ /index.php [QSA,L]
mareenator
  • 351
  • 2
  • 4