Skip to content Skip to sidebar Skip to footer

Why Would Anyone Set (Apache Mod_expires Parameter) ExpiresByType To "access Plus 0 Seconds"?

In reviewing the answer to this post, I don't understand why 0 seconds is used for best practice here: ExpiresByType text/html 'access plus 0 seconds' I think this means that when

Solution 1:

If text/html only meant "content from static HTML files", you'd be right, and you'd want to set a longer cache life. But server-side scripts typically also return a web page; that is, their responses' Content-Type will often be text/html as well. And if all HTML were cached, dynamically generated content might not appear to update properly.

If you wanted to expire only non-static HTML, you might be able to do something like

<FilesMatch "\.php$">
    ExpiresByType text/html "access plus 0 seconds"
</FilesMatch>

(using PHP as an example).


Post a Comment for "Why Would Anyone Set (Apache Mod_expires Parameter) ExpiresByType To "access Plus 0 Seconds"?"