是否有可能返回一个304未修改用的.htaccess有可能、htaccess

2023-09-02 00:46:13 作者:六个字的霸气

如果用户有缓存在其浏览器中的文件,他们发送带有如果修改 - 因为标题中的http请求,是有办法来自动为他们服务一个 304未修改反应使用的.htaccess?

If a user has a file cached in their browser and they send a http request with an If-Modified-Since header, is there a way to automatically serve them a 304 Not Modified response using .htaccess?

推荐答案

这是间接的解决方案:

的.htaccess:

.htaccess:

RewriteCond %{HTTP:if-modified-since} .
RewriteRule . /not_modified.php [L]

not_modified.php:

not_modified.php:

header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified');