问题原文
原帖链接 · skonka · CC BY-SA 3.0
We are trying to set Cache-Control header: max-age=300, public to all our public site pages. To use Filesmatch, my applciation pages do not have any extensions. ExpiresByType is available, but it has its own disadvantages.
I am looking for a way to set cache control header to all my application pages with content type as text/html. Is there any way to achieve this?
社区高分解答
原帖链接 · Null · CC BY-SA 4.0
A safer way (because developers can make misstakes when setting Content-Type for file extensions) is to set header based on the actual Content-Type:
<IfModule mod_headers.c>
Header set Cache-Control "max-age=300, public" "expr=%{CONTENT_TYPE} =~ m#text/html#i"
</IfModule>
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
