In some cases, it is required that the web server issues the Last-Modified HTTP header. For example, when registering your resource on Yandex, the error “Incorrect dates” appears. For static documents, the server will always return the last-modified value. This is valid for html files. For SSI, the server will output the last-modified value if the “XBitHack full” directive is specified (just write this line in .htaccess), and the file being accessed has the “executable” attribute set for the group. In scripts, last-modified is issued by other means. For example, if we take into account that the PHP script generates code dynamically, then the most logical thing would be to give the current date and time as last-modified./>
This is implemented as follows:
<? header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); ?>
Please note: the header command must be executed in the PHP script before the script starts outputting html text to the user's browser.