Apache will not set headers for PHP script

This .htaccess file:

 <IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 4 month" </IfModule> <IfModule mod_headers.c> Header merge X-ModHeaders "Yes, it is installed" </IfModule> 

... works as expected in my development window (Windows window, Apache / 2.4.10, PHP works as an Apache module), where "works" means that it generates assignment headers for all resources (static or dynamic).

However, on my working server (Linux box, Apache / 2.2.31, PHP works like FastCGI with mod_fcgid / 2.3.9) it works only for static resources, and not for PHP scripts.

Do I correctly suspect that the difference comes from PHP SAPI? Is there a way to fix this, so I donโ€™t need to duplicate the code that generates the HTTP headers?

+2
source share
1 answer

If PHP works through mod_proxy_fcgi, there can be no file system directory, so htaccess cannot be searched.

There is a more recent flavor, php + mod_proxy_fcgi, which is now described in a manual that uses SetHandler instead of ProxyPass, which allows you to handle things like htaccess because the kernel actually looks at the URL in the file system as a first step.

+2
source

All Articles