0

I have the following configure in my apache config:

<VirtualHost *:80>
    <Directory "/var/www/site.com">
            Options +Indexes +FollowSymLinks +ExecCGI -MultiViews
            AllowOverride All
            DirectoryIndex /index.html /pages/new_homepage.php
            Order allow,deny
            allow from all
            Require all granted
    </Directory>
    <LocationMatch ^(.*\.php)$>
                ProxyPass fcgi://127.0.0.1:9000/var/www/site.com$1
    </LocationMatch>

</VirtualHost>

and this in a .htaccess file:

RewriteRule ^dir/somephp.php$ /pages/dir/somephp.php [L]

I am seeing the original request being passed to PHP-FPM rather than the ReWritten request. I tested it, and the ".php" part is being matched. Other rewrites without .php work perfectly.

Apache 2.4 docs say that "LocationMatch" should be processed last, and after the Directory directive. http://httpd.apache.org/docs/current/sections.html

Has anyone else seen this behavior or have any suggestions to try?

I'm running Centos 7 with Apache 2.4.6.

--update-- Well I'm confused, does ProxyPass nested inside LocationMatch take the precedence of LocationMatch? I enabled a nasty workaround of using multiple LocationMatch statements:

    <LocationMatch ^(.*\.php)$>
           ProxyPass fcgi://127.0.0.1:9000/var/www/site.com$1
    </LocationMatch>
    <LocationMatch ^(/dir/some.*\.php)$>
            ProxyPass fcgi://127.0.0.1:9000/var/www/site.com/pages$1
    </LocationMatch>
    <LocationMatch ^(/dir2/some.php)$>
            ProxyPass fcgi://127.0.0.1:9000/var/www/site.com/pages$1
    </LocationMatch>

Still I'd love to figure out why Locationmatch is sending to the php server before .htaccess has been processed.

Richard
  • 1
  • 2

0 Answers0