I've started caching CSS and JavaScript using .htaccess and a auto_prepend_file, and was wondering why the same technique isn't working for images? For example:
/css/.htaccess
Code: Select all
AddHandler application/x-httpd-php .css
php_value auto_prepend_file gzip-css.phpCode: Select all
<?php
ob_start('ob_gzhandler');
header('Content-type: text/css; charset: UTF-8');
header('Cache-Control: must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s', time()+(60*60*24)).' GMT');
header('Last-Modified: '.gmdate("D, d M Y H:i:s", time()-(60*60*24)).' GMT'); // not too sure if this is naughty
?>/img/.htaccess
Code: Select all
AddHandler application/x-httpd-php .png
php_value auto_prepend_file gzip-png.phpCode: Select all
<?php
ob_start('ob_gzhandler');
header('Content-type: image/png');
header('Cache-Control: must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s', time()+(60*60*24)).' GMT');
header('Last-Modified: '.gmdate("D, d M Y H:i:s", time()-(60*60*24)).' GMT');
?>Thanks and regards, Ben