.htaccess conflict

software development

#1

I need these two items to work together in order to read my custom php.ini and get the installed cms working properly. They work seperately just fine, but throw them together in any order and poof

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

-and-

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/file/.*
RewriteCond %{REQUEST_URI} !^/install/.*
RewriteCond %{REQUEST_URI} !^/update/.*
RewriteCond %{REQUEST_URI} !^/design/.*
RewriteCond %{REQUEST_URI} !^/plugins/.*
RewriteCond %{REQUEST_URI} !^/vbforum/.*
RewriteRule ^index.php(/.)$ /index.php?do=$1 [L]
RewriteCond %{REQUEST_URI} !^/file/.

RewriteCond %{REQUEST_URI} !^/install/.*
RewriteCond %{REQUEST_URI} !^/update/.*
RewriteCond %{REQUEST_URI} !^/design/.*
RewriteCond %{REQUEST_URI} !^/plugins/.*
RewriteCond %{REQUEST_URI} !^/vbforum/.*
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ^(.*)$ /index.php?do=/$1 [L]

any advice would be greatly appreciated.


#2

Nevermind, I finally figured it out after all day looking at this stupid thing LOL… I’ve seen tons of posts on this all over but no solutions, so in case anyone else runs into this, the answer is that the rewrite engine is redirecting the request no matter where you put this in the file, so since you have to manually insert the cgi-bin folder to get the custom install, you will have to manually add it into the rewrite engine as well on both levels. So simple I could slap myself, but it usually is.
Soooooo… your ReWrite instructions will have to be changed to this:

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/file/.*
RewriteCond %{REQUEST_URI} !^/cgi-bin/.*
RewriteCond %{REQUEST_URI} !^/install/.*
RewriteCond %{REQUEST_URI} !^/update/.*
RewriteCond %{REQUEST_URI} !^/design/.*
RewriteCond %{REQUEST_URI} !^/plugins/.*
RewriteCond %{REQUEST_URI} !^/vbforum/.*
RewriteRule ^index.php(/.*)$ /index.php?do=$1 [L]

RewriteCond %{REQUEST_URI} !^/file/.*
RewriteCond %{REQUEST_URI} !^/cgi-bin/.*
RewriteCond %{REQUEST_URI} !^/install/.*
RewriteCond %{REQUEST_URI} !^/update/.*
RewriteCond %{REQUEST_URI} !^/design/.*
RewriteCond %{REQUEST_URI} !^/plugins/.*
RewriteCond %{REQUEST_URI} !^/vbforum/.*
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ^(.*)$ /index.php?do=/$1 [L]


#3

Heh, we have all done that. Rewrite rules always confuse the hell out of me.

Thanks for sharing the (now obvious) fix that none of us noticed! :slight_smile:

–rlparker


#4

Thanks to rlparker that direct me to this thread

I had try for hours to add this line

RewriteCond %{REQUEST_URI} !^/cgi-bin/.*

to my htaccess below, but i think i am still not using custom php.ini in cgi-bin folder right now, where is exactly i need to add that line

and do i still need this line? i had remove it

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

This is my htacess

RewriteEngine On

RewriteCond %{QUERY_STRING} !vbseourl=
RewriteCond %{REQUEST_URI} !(admincp/|modcp/|chat|cron)
RewriteRule ^(.*.php)$ vbseo.php?vbseourl=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !.(jpg|gif)$
RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|images)/
RewriteRule ^(.+)$ vbseo.php?vbseourl=$1 [L,QSA]