Apache 2.4 ProxyPassMatch with .htaccess rewrite

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?

0 Replies

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct