I know that we can easily base a RewriteCond on any http request header. But can we check (some of) the response headers that are going to be sent? In particular, the Last-modified one?
I want to rewrite a url only when the Last-modified date is older than 30 minutes and I’m trying to avoid the overhead of delegating that check to a php file every single time a file from that directory is requested.
Thanks in advance!
The outbound headers do not exist until
muchlater thanmod_rewriteis acting. There also isn’t any file-modification-time checking functionality built intomod_rewrite, so the closest you’d get using it is making a RewriteMap of the External Rewriting Program variety to find out whether the file in question has been modified.If I understand your application correctly, you could also look into having a cron job delete files in that directory that are older than 30 minutes, and then rewriting on a file-nonexistence condition.