I have Apache 2.4 working with php7 using php-fpm. I'm using this block to pass traffic to php-fpm

<FilesMatch "\.php$">
    SetHandler "proxy:fcgi://"

The problem I'm having is that parts of the application I'm using, piwik, create php images with urls like this


because there is no .php in the url the FilesMatch fails. If I manually change the url to something like https://xxxxx.edu/piwik/index.php?module= it works fine...

So I'm thinking that either changing the FilesMatch to catch module= or creating a rewrite rule to insert index.php would work but I could use some help doing either.

  • Unfortunately I don't know how to do it exactly in Apache, but you need to declare index.php as the directory index file in the Apache configuration. This way all requests where the path component of the URL ends up with / will be passed to index.php at the corresponding path. – Tero Kilkanen Feb 28 '17 at 14:18
  • Thank you Tero - That was just enough to help me figure it out... I modified the .htaccess file in the root adding DirectoryIndex index.php and added AllowOverride Indexes to the httpd.conf. – buffcleb Feb 28 '17 at 14:32

Based on Tero's response I found that I could make two changes that fixed things:

add Indexes to the AllowOverride for the directory in the VirtualHost settings

add DirectoryIndex index.php to the .htaccess file in the root of that directory.

not sure if its the best solution but it does work.

  • AllowOverride and .htaccess are a solution for nothing, just a functionality to give non-admin permissions over config in certain directories. You probably just need FallBackResource /index.php – ezra-s Mar 3 '17 at 1:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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