Welcome Guest, Not a member yet? Register   Sign In
.htaccess & dreamhost - error combining two parts [solved]
#1

[eluser]Diggory Laycock[/eluser]
Hi,
Sorry, yet another .htaccess issue - I was hoping someone could help me figure out what I'm doing wrong.

Here's the scenario:
I've got a standard htaccess format that I use for my codeigniter sites that normally works very well: e.g.

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

I've been using this on a site I've had in development for a client. The site is hosted at DreamHost, and while in development the site was hidden in a subdirectory of the web root: i.e. http://www.myclient.com/staging/ and it was all working well.

The site allows the client to upload his own videos. DreamHost's default php.ini has a relatively small max_upload - so in order to allow the client to upload larger videos I had to place an .htaccess file in the web root of the site which runs php files with a custom php wrapper as per this page: http://wiki.dreamhost.com/index.php/PHP.ini
Code:
Action php-cgi /cgi-bin/php-wrapper.cgi
Action php5-cgi /cgi-bin/php-wrapper.cgi

That all worked well - and the upload limit was enlarged as per my custom php.ini

However - once the site was to go live - the codeingiter directory became the same as the web root - so I need to combine these two .htaccess files. I assumed I could just combine them as so:

Code:
Action php-cgi /cgi-bin/php-wrapper.cgi
Action php5-cgi /cgi-bin/php-wrapper.cgi

<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>

Alas - this doesn't appear to work - if I use either of them on their own they work - but if I combine the directives into one file I get the following:

Quote:Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, <email removed> and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

I'm a bit mystified by why this should happen.

Has anyone got any ideas? Thanks.
#2

[eluser]thecancerus[/eluser]
I think you need to change the RewriteBase to /
#3

[eluser]Diggory Laycock[/eluser]
I had already changed the Rewrite base. I just copy & pasted the htaccess from earlier in the post when posting to the forum, that's why it appears wrong.

Thanks for trying to help though.

[edited earlier post]

Any more ideas anyone?
#4

[eluser]GSV Sleeper Service[/eluser]
check your apache error logs, they can sometimes reveals a bit more info about the error.
#5

[eluser]Diggory Laycock[/eluser]
Thanks to anyone who took a look at this.
It seems the combination of the two directives was causing an infinite loop:

Quote: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.

I've got it working now with the following htaccess:

Code:
<IfModule mod_actions.c>
        Action php-cgi /cgi-bin/php-wrapper.cgi
        Action php5-cgi /cgi-bin/php-wrapper.cgi
</IfModule>

<IfModule mod_rewrite.c>
        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]
</IfModule>
#6

[eluser]pdswan[/eluser]
Thanks for the fix!

Just out of curiosity how did you come about this solution? I was able to figure what was happening but had no clue how to fix it.
#7

[eluser]Diggory Laycock[/eluser]
I had forgotten that DreamHost logs are in your home directory: once I'd looked in (~/logs/domain.com/http/error.log) i noticed that the error
Quote:"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."
was appearing.

I googled something from that and found the answer (I can't remember the exact phrase - probably something like "htaccess LimitInternalRecursion" )
#8

[eluser]Mark Krieger[/eluser]
I figured it out: I missed the extra lines in your .htaccess, I put them in, it all works fine now!

Mark

I have exactly the same problem, I have a new php which I've built (I need SOAP) and I have some rewriting rules for CI. I am using dreamhost for now, they have a php installed with no SOAP support....

Here is the .htaccess:

<IfModule mod_actions.c>
Options +ExecCGI
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi
</IfModule>
<FilesMatch "^php5?\.(ini|cgi)$">
Order Deny,Allow
Deny from All
Allow from env=REDIRECT_STATUS
</FilesMatch>

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|images|captcha|user_guide|assets|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>

this fails with an error 500. If I change the first line to:

<IfModule !mod_rewrite.c>

it 'works', but then the actionhandler to use a custom php fails to use it, it uses the php bin in /usr/local/bin. And if I just have the first group of stuff, with no rewrite rules, I do get the new php! Weird!!!!

Help!!!???

Mark




Theme © iAndrew 2016 - Forum software by © MyBB