2.4.3.20. Server does not return Last-Modified HTTP header
Attention!
Title will not be returned for dynamic content if any module options are enabled PageSpeed.
Shared hosting servers return the HTTP header by default Last-Modified
for static content (images, stylesheets, JS scripts). If you are faced with a situation where the server does not return this header, you should check if the option is enabled «SSI» в site settings:
If option «SSI» enabled, the server will not return a header for content submitted by the Apache web server. For static content, the title will be returned anyway. The work of the SSI technology is provided thanks to the modules of the Apache web server, which we use as a backend server on the hosting. V official documentation reported that when using SSI, the header Last-Modified
not returned because it is difficult to calculate the last modified time for dynamic content.
For dynamic content (dynamic pages, PHP scripts), this header must be passed independently. The following code can be used as an example:
<?php $LastModified_unix = 1294844676; // время последнего изменения страницы $LastModified = gmdate("D, d M Y H:i:s \G\M\T", $LastModified_unix); $IfModifiedSince = false; if (isset($_ENV['HTTP_IF_MODIFIED_SINCE'])) $IfModifiedSince = strtotime(substr($_ENV['HTTP_IF_MODIFIED_SINCE'], 5)); if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) $IfModifiedSince = strtotime(substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 5)); if ($IfModifiedSince && $IfModifiedSince >= $LastModified_unix) { header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified'); exit; } header('Last-Modified: '. $LastModified);
You can check the work of the header and get additional recommendations on how to work with it on the website last-modified.com.