I do have a massive Issue with Caching and ModExpire on php Files if i'am using following in my global .htaccess
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/xhtml-xml "access plus 600 seconds"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
</IfModule>
<ifmodule mod_headers.c>
<filesmatch "\\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesmatch>
<filesmatch "\\.(css)$">
Header set Cache-Control "max-age=604800, public"
</filesmatch>
<filesmatch "\\.(js)$">
Header set Cache-Control "max-age=216000, private"
</filesmatch>
<FilesMatch "\.(php)$">
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</FilesMatch>
</ifmodule>
If i am running a php file, which is returning a value and saving sth. in a MySQL DB, i have to reload twice or three times until all is done right.
I also had tried the following on the specified file without success (as mentioned here How to prevent http file caching in Apache httpd (MAMP) )
<files folder/file.php>
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</files>
same if i put no-cache inside the folders htaccess
The two "ExpiresByType" lines are probably the reason for this problem as you have already identified.
Your .php files return documents of type text/html or application/xhtml-xml. So the headers being set by FilesMatch *.php contradict the previous entries. Which one is then chosen? I don't know.
Generally, the results of PHP file execution should rarely be cached.
To prevent php files from caching try to remove
ExpiresByType application/xhtml-xml
, which is for PHP.IMHO you can also remove
FilesMatch
for PHP files.