apache - 添加没有 mod_expires 的 expires header ?

标签 apache .htaccess mod-expires

我知道我可以使用 mod_expires 添加过期 header 。但是,如果 Apache 服务器没有安装 mod_expires 并且我不想通过像 PHP 这样的脚本语言路由对文件的访问,我该怎么办?

最佳答案

您可以使用 mod_header手动设置标题字段:

Header set Expires "..."

但由于 Expires需要 absolute time , 使用 Cache-Control相对于访问时间的时间的 max-age 参数:
Header merge Cache-Control max-age=3600

关于apache - 添加没有 mod_expires 的 expires header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3626036/

相关文章:

php - Apache mod_rewrite 问题

php - 具有单个 CloudFront 分发的多个网站不会被路由

.htaccess 规则,在 url 中重写 key

apache - htaccess - 条件重写和过期

.htaccess - 合并 s-maxage 和 max-age

regex - 使用参数重定向到其他域

php - Python 无法打开文件

python - Django 不使用 fastcgi 提供管理静态文件

.htaccess - 如何通过htaccess保护特定url

apache - 如何使浏览器缓存 Apache 上的静态内容,而不是在每个请求时检查新鲜度?