Search code examples
mod-rewritepathinfo

Rewrite everything to be after index.php/


I'm setting up a php mvc framework and I want to redirect anything after the domain to index.php/$1 but it's not working. I have rewrite_module enabled and AllowOverride All, is there something else I'm missing?

Basically I want the url to go from this http://www.example.com/foo/bar to http://www.example.com/index.php/foo/bar so I can grab it from $_SERVER['PATH_INFO']

Here's what I have...

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]

httpd-vhosts.conf

NameVirtualHost *:80

<VirtualHost *:80>
  DocumentRoot c:/wamp/www
  ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "c:/websites/snugglemvc"
    ServerName www.snugglemvc.com
    <Directory "c:/websites/snugglemvc">
        Order Deny,Allow
        Allow from all
        AllowOverride all
    </Directory>
</VirtualHost>

Solution

  • it was an issue with my httpd.conf file. i didn't have AllowOverride all on the localhost. once I changed that everything worked.