I'm about at my wits' end with mod_rewrite problems trying to deploy a CakePHP app on shared hosting with Apache 1.3. Despite using the default .htaccess files I seem to be plagued by rewrite loops and lots of trial and error hasn't really got me anywhere.
On the server my app is installed in:
/home/www/myusername/testing
Apache accesses this directory via a subdomain symlink:
/home/www/hosts/testing.mydomain.com/
My CakePHP app is on the root inside 'testing', with a dir structure like:
/home/www/myusername/testing/
webroot/
controllers/
etc...
The base .htaccess looks like (as per the defaults):
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
The webroot .htaccess looks like:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
This all seems to work on my laptop (with Apache 2.2) but gives me errors on the server because it seems to be endlessly rewriting the request. If I access the any URI, base or not, I get a 403 error with this in the Apache error log:
File name too long: access to /home/www/hosts/testing.mydomain.com/webroot/home/www/hosts/testing.mydomain.com/webroot/home/www/hosts/testing.mydomain.com/webroot/home/www/hosts/testing.mydomain.com/webroot/home/www/hosts/testing.mydomain.com/ [REPEAT FOR A LONG TIME...]
Can anyone see anything that'd lead to the endlessly appended rewrite here? I've tried a bunch of things, such as adding RewriteConds to test the uri doesn't already contain 'webroot' but nothing seems to work. I'm willing to bet it's something obvious though!
Thanks.