Combining .htaccess

design

#1

Hello,

I’ve got a site on DH and am having an issue with .htaccess files.

I’ve developed this site using a PHP framework called CodeIgniter which uses mod_rewrite as so:

<IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond $1 !^(index\.php|public|user_guide|robots\.txt) RewriteRule ^(.*)$ index.php/$1 [QSA,L] </IfModule> Which works fine.

However I also want to use a PHP wrapper to use my own custom php.ini like so:

<IfModule mod_actions.c> Action php-cgi /cgi-bin/php-wrapper.cgi Action php5-cgi /cgi-bin/php-wrapper.cgi </IfModule> If I try either of these as the .htaccess they work - however I would like both of them, so I combined them into one .htaccess file like so:

[code]
Action php-cgi /cgi-bin/php-wrapper.cgi
Action php5-cgi /cgi-bin/php-wrapper.cgi

Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond $1 !^(index\.php|public|user_guide|robots\.txt) RewriteRule ^(.*)$ index.php/$1 [QSA,L] [/code]But I always get a 500 error from the server when the .htaccess file is like that.

Does anyone know what I’m doing wrong? Why do they work individually, but not combined?


#2

Have you tried it adding a handler in mod_actions.c?

AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#3

Hmm - just tried adding the handler as you suggested, it didn’t appear to make a difference.

I’ve also just worked out where DH stores my logs and found the error log:

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.Is the combination of the two sets of directives causing an infinite loop?


#4

I’ve managed to solve it like this:

[code]
Action php-cgi /cgi-bin/php-wrapper.cgi
Action php5-cgi /cgi-bin/php-wrapper.cgi

Options +FollowSymLinks RewriteEngine on RewriteBase /

RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]

RewriteCond $1 !^(index.php|public|stats|user_guide|robots.txt)
RewriteRule ^(.*)$ index.php/$1 [QSA,L]

[/code]