How to specify a cache validator for autoptimize


   

to specify a cache validator for autoptimize you must go to plugins directory /autoptimize/config and edit default.php

you must replace:

// Send compressed contents
header(‘Content-Encoding: ‘.$encoding);
}
header(‘Vary: Accept-Encoding’);
header(‘Content-Length: ‘.strlen($contents));

header(‘Content-type: %%CONTENT%%; charset=utf-8′);
header(‘Cache-Control: max-age=315360000, public, must-revalidate’);
header(‘Expires: ‘.gmdate(‘D, d M Y H:i:s’, time() + 315360000).’ GMT’); //10 years

with :
// Send compressed contents

$if_modified_since = preg_replace(‘/;.*$/’, ”, $HTTP_IF_MODIFIED_SINCE);

$mtime = filemtime($SCRIPT_FILENAME);
$gmdate_mod = gmdate(‘D, d M Y H:i:s’, $mtime) . ‘ GMT’;

if ($if_modified_since == $gmdate_mod) {
header(“HTTP/1.0 304 Not Modified”);
exit;
}
header(“Last-Modified: $gmdate_mod”);

and you must edit delayed.php too and replace same thing as you did on default.php.

Enjoy it!

Tags: , , , , , , , , , ,

Related posts