Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have Apache 2.4 set up with PHP-FPM on a server. To pass from Apache to PHP-FPM I use the following:

ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9001/hosting_files/site.com/admin_secure/$1

"admin_secure" is the DocumentRoot in the vhost.

In that directory, I have a .htaccess file that contains the following:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
 </IfModule>

The site works, right up until I try to access something that should be in the webroot directory. For example, if I go to vendors/kcfinder/browse.php which is inside the webroot directory, I get a "File not found" error. If I go to webroot/vendors/kcfinder/browse.php, it works.

I've turned on rewrite and proxy logging, and it looks like the rewrite never takes place. It just sends whatever I type in the URL (if it's a PHP file).

Is there a way to write my ProxyPassMatch statement to take in rewrites like that?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Your problem is that the .htaccess file is never read. .htaccess is only read after apache has determined that it needs to look for the resource requested on its local filesystem. You are however telling apache to forward the request to another process...

You will need to add the rewrites to your main config.

share|improve this answer
    
Either that or dump mod_proxy_fcgi and use mod_fastcgi. –  Kontrollfreak Jan 5 at 12:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.