开发者

Rewrite everything to be after index.php/

I'm setting up a php mvc framework and I want to redirect anything aft开发者_高级运维er 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>


I believe you need the leading slash on /index.php as your regex matches beginning of line.

RewriteEngine On

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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜