【发布时间】:2016-12-17 15:08:22
【问题描述】:
我在 Apache 2.4 的 .htaccess 中有以下内容:
ExpiresActive On
ExpiresDefault "access plus 1 month"
但是,不应缓存以today_ 开头的页面(文件实际上不 存在于服务器上)。你会怎么写那个条件?
【问题讨论】:
标签: .htaccess cache-control apache2.4 mod-expires
我在 Apache 2.4 的 .htaccess 中有以下内容:
ExpiresActive On
ExpiresDefault "access plus 1 month"
但是,不应缓存以today_ 开头的页面(文件实际上不 存在于服务器上)。你会怎么写那个条件?
【问题讨论】:
标签: .htaccess cache-control apache2.4 mod-expires
如果您使用的是 Apache 2.4,那么您应该是 :) 您可以简单地使用条件语句。我认为这些都被忽略了很多。我会这样处理它。
#if URL contains today_ turn it off
<If "%{REQUEST_URI} =~ /today_/">
ExpiresActive Off
</If>
<Else>
ExpiresActive On
ExpiresDefault "access plus 1 month"
</Else>
【讨论】:
<If "%{REQUEST_URI} =~ /(today_|hoy_|hoje_)/">