Answer the question
In order to leave comments, you need to log in
Why does If-Modified-Since not work with Litespeed WordPress plugin and response code is always 200?
Hello! The LiteSpeed plugin is installed on WordPess, the hosting also works on LiteSpeed.
Added code:
<?php
$LastModified_unix = 1594844676;
$LastModified = gmdate("D, d M Y H:i:s \G\M\T", $LastModified_unix);
$IfModifiedSince = gmdate("D, d M Y H:i:s \G\M\T", $LastModified_unix);
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);
header('If-Modified-Since: '. $IfModifiedSince);
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question