Htaccess, custom php, modrewrite and cakephp


Hi there!

I’ve been stuck for a few hours over this. I founds lots of information online but nothing that solved my issue.

I’m hosted on Dreamhost with a custom PHP installation (5.2.14). The site returns a 500 Internal Server Error with this .htaccess file.

It looks like the rewrite rule is also applied to my php.cgi file but I don’t know how to avoid that.

My log files shoes that there is an infinite loop somewhere “Request exceeded the limit of 10 internal redirects due to probable configuration error”.

Options +ExecCGI
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

<FilesMatch "^php5?\.(ini|cgi)$">
Order Deny,Allow
Deny from All
Allow from env=REDIRECT_STATUS

RewriteEngine on
RewriteBase /
RewriteRule    ^$ app/webroot/    [L]   
RewriteRule    (.*) app/webroot/$1 [L][/code]

Cakephp also include the following 2 htaccess files :

app/.htaccess :

RewriteEngine On RewriteBase / RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L]

And app/webroot/.htaccess

RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

Any idea what’s wrong in my set-up?


Here’s are the settings from my CakePHP v1.2.6 install:

.htaccess & app/.htaccess

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]


<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

There doesn’t appear to be a php.cgi as part of my install.