Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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://$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]

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
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 '14 at 12:46

Your Answer


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.