tags:

views:

45

answers:

1

I've come across a problem with an .htaccess rule I can't sort out. It works on my MAMP stack and it works on 3 other servers, but it won't work on a particular server and keeps giving me a "500 error with an additional 302 error".

It's the wildcard that's throwing it and from Google research it says it may be because of an infinite loop, but it works on other servers just fine.

The site in question is being developed in a sub-directory, but then again, so have the other sites:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule    ^$    public/    [L]
RewriteRule    (.*) public/$1    [L] 

/public has it's own .htaccess file that is:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

Any suggestions as mod_rewrite's not my specialty and I can't seem to fix this.2

A: 

Try

main:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteBase /subdir

RewriteRule    ^$    public/    [L]
RewriteRule    (.*) public/$1    [L]

/public .htaccess

RewriteBase /subdir/public
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

any luck?

Dan Heberden
No - it can't find /public (which is correct as it's subdir/public) but as soon as I change the top one to (.*) subdir/public/$1 [L] I get the 500 error again. I tried the subdir in various parts and all come up with 500 or 302 errors.
niggles
updated answer based on info - any luck? I suggest it because some hosts have issues, like rackspacecloud, godaddy, etc
Dan Heberden
You know what, it's not the .htaccess - i stripped down the /public/index.php file to nothing and it worked... kept adding lines back in and it turns out this server is going nuts with Database session storage! Calling session_start() bombs it with a 500 error, but only when I'm using my DB storage class. Oh well, new issue to sort :-)
niggles