Reputation: 3188
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?
Upvotes: 2
Views: 4991
Reputation: 3188
An indirect solution:
.htaccess:
RewriteCond %{HTTP:if-modified-since} .
RewriteRule . /not_modified.php [L]
not_modified.php:
header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified');
Upvotes: 3
Reputation: 30001
Check out the following links:
Notice, that from the above link:
If you remove the Last-Modified and ETag header, you will totally eliminate If-Modified-Since and If-None-Match requests and their 304 Not Modified Responses, so a file will stay cached without checking for updates until the Expires header indicates new content is available!
Upvotes: 1