fastCGI and rewites cause 404 error (only runing fastCGI breaks them)

Discussion in 'Apache' started by ctrenks, Mar 16, 2012.

  1. #1
    OK, I want to run fastCGI to allow Xcache to run on my site. Everything went well with php 5.3.10 upgrade and adding fastCGI as a handeler.

    When I switch to FastCGI though pages work but re-directs throw a 404 error. here is the basics of my .htaccess in the root of web directory.

    
    <Files ~ "\.inc$">
       Order allow,deny
       Deny from all
       Satisfy All
    </Files>
    
    Header unset ETag
    FileETag None
    
     
    # 2 HOURS
    <FilesMatch "\.(html|htm|php)$">
    Header set Cache-Control "max-age=7200, must-revalidate"
    </FilesMatch>
    
    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    Header set Cache-Control "public"
    Header set Expires "Thu, 15 Apr 2015 20:00:00 GMT"
    </FilesMatch>
    
    AddHandler fastcgi-script .exe
    Options +FollowSymLinks +ExecCGI
    
    #Options +FollowSymlinks 
    RewriteEngine on 
    RewriteBase /
    
    
    RewriteCond %{HTTP_HOST} ^afc\.com 
    RewriteRule (.*) http://www.afc.com/$1 [R=301,L] 
    
    RewriteRule ^([a-z0-9-]+)\.html$ index\.php?id=$1 
    
    
    Code (markup):
    this should take httx://www.afc/$1.html to index\.php?id=$1
    works ok except under fastCGI

    Thanks!
    Chris
     
    ctrenks, Mar 16, 2012 IP
  2. ctrenks

    ctrenks Member

    Messages:
    17
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #2
    OK, I found that its not the rewire rules, it is a section with a query_string in a condition.
    
    #This rule must be in each directory which have to be supported (without forum directory itself)
    RewriteCond %{QUERY_STRING} !vbet_outside=true
    RewriteRule ^(.*)$ $1?vbet_outside=true [L,QSA]
    
    Code (markup):
    remocing this allows everything else to work ok insi FCGI mode.

    veing new with the FCGI I have yet to find a definition on why query_string is no longer valid in .htaccess

    Also are other server vars changed under FCGI that will effect php code?
     
    ctrenks, Mar 18, 2012 IP