基于mod_rewrite的的RewriteCond上次修改? (htaccess的) [英] mod_rewrite RewriteCond based on Last-modified? (.htaccess)

查看:157
本文介绍了基于mod_rewrite的的RewriteCond上次修改? (htaccess的)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,我们可以很容易地基地的RewriteCond任何HTTP 请求头。但是,我们检查(部分)在响应发送标头打算?特别是,在上次修改吗?

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?

我想重写URL只在最后修改日期是早于30分钟,我想,以避免委托,办理入住手续的PHP文件,每一次从该目录中的文件的开销请求。

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.

在此先感谢!

推荐答案

出站头不存在,直到晚于的mod_rewrite 行事。目前也没有任何文件修改时间检查功能内置到的mod_rewrite ,所以你开始使用它制作的的外部重写程序的品种,以找出是否有问题的文件已被修改RewriteMap指令

The outbound headers do not exist until much later than mod_rewrite is acting. There also isn't any file-modification-time checking functionality built into mod_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.

如果我正确理解你的应用程序,你也可以考虑其在该目录中存储时间超过30分钟cron作业删除文件,然后重写一个文件不存在的条件。

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.

这篇关于基于mod_rewrite的的RewriteCond上次修改? (htaccess的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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