A strange problem occurs when GZipping files on our (updated?migrated) shared hosting server.
Examine these two identical files in the the includes folder /_inc/
with exactly the same contents (php code) with the purpose of collecting, minifying and generating a single Gzipped css file from various source cdd files. Now, files ending with php seem to get GZipped nicely, however files ending with extension css and js do not get GZipped yet...
/_inc/all.css (24 kbyte, extension won't let herself Gzipped)
/_inc/allcss.php (5 kbyte! extension lets herself Gzipped)
Changing the extension from css to php makes the file to compress as you see, BUT browsers still prefer the css extension for best caching...
Q: Why is it, that only files ending with php are Gzipped, and php files ending with css and js extension are not Gzipped? How to achieve Gzipping for css and js extensions as well? How can I set the main .htacces or php.ini to Gzip all .php, .css, .js files as well?
/.htaccess (root .htaccess file portion for compression)
## interpreted extensions as php
AddType application/x-httpd-php .php
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
#AddType text/css css
#AddType text/javascript js
## compress speficic filetypes BUTTTT doesn't work anymore since server upgrade!
## with or without the code below the result is the same!
<IfModule mod_deflate.c>
<FilesMatch "\.(js|css|eot|ttf|svg|xml|php|txt)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
/_inc/.htaccess (.htacces file that makes css and js files interpret as php files)
AddType application/x-httpd-php-cgi .js .css
Action application/x-httpd-php-cgi /cgi-php/php-cgi
php.ini (from the Apache server running PHP 5.3.28)
session.gc_maxlifetime = 1440
session.name = PHPSESSID
session.save_handler = files
session.serialize_handler = php
zlib.output_compression = On
zlib.output_handler = ob_gzhandler
allow_call_time_pass_reference =
implicit_flush = Off