Answer the question
In order to leave comments, you need to log in
Last-modified for the search engine and blocking browser caching, how will the search engine behave?
Hello,
on the Internet I saw different non-specific opinions on this matter, please advise. My question is:
header("Cache-Control: no-cache,no-store,max-age=0,must-revalidate"); //запрет кеширования
header("Expires: " . date("r")); // ставится текущая дата и время // тоже запрет кеширования
header('Last-Modified: '. $LastModified); // ставится реальная дата когда менялся домкумент
$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));
header("Cache-Control: no-cache,no-store,max-age=0,must-revalidate"); // иногда используют
header("Expires: " . date("r"));
if ( $IfModifiedSince && $IfModifiedSince >= $LastModified_unix ){
header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
exit;
}
header('Last-Modified: '. $LastModified);
Answer the question
In order to leave comments, you need to log in
Damn, I just saw it, the opera still caches ...
how to make it so that search engines give Last-modified, and browsers do not pay attention to last-modofied, only track browsers?
Search engines do NOT consider Last-modified, Expires and Cache-Control to determine whether or not to index a page.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question