<?php
$content_type = "text/css"; // File's content type you're serving dynamically
$if_mod = $_SERVER['HTTP_IF_MODIFIED_SINCE']; // Depending on your server, this variable may be differently named
if (strlen($if_mod) >
2) { // if-last-modified header sent if ($actual_last_mod > $if_last_mod_sent) { // Need fresh results
header("Content-Type: {$content_type}");
header("Comment: Need fresh results");
}
else { // Have latest results
header("HTTP/1.1 304 Not Modified");
header("Content-Type: text/html");
// This content-type is always returned for a HTTP 304 response header("Comment: Have fresh results");
}
}
else { // No if-last-modified header sent
header("Content-Type: {$content_type}");
header("Comment: No if-last-modified header sent");
}
?>