是否有可能返回一个304未修改用的.htaccess [英] Is it possible to return a 304 Not Modified with .htaccess

查看:177
本文介绍了是否有可能返回一个304未修改用的.htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果用户有缓存在其浏览器中的文件,他们发送带有如果修改 - 因为标题中的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');

这篇关于是否有可能返回一个304未修改用的.htaccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆