How do I set Apache set HTTP headers which cache all resources for 15 mins but also allow .htaccess files in a directory to override these settings on a per-site basis?
1 Answer
If you're talking about mod_expires (telling browsers how to cache the content), then you would put something like this in your httpd.conf:
ExpiresDefault A900 #15 minutes
And then in the .htaccess:
ExpiresDefault A3600 #1 hour
You can also override by type of resource, using ExpiresByType
If you're talking about caching the content server-side (mod_cache), these directives can only be done in httpd.conf and vhosts files. .htaccess cannot override them.
-
Yes mod_expires is what I'm talking about,so ExpiresDefault will work for any type of resource?– TomJan 9, 2011 at 11:27
-
assuming in your main httpd.conf configuration you haven't set a ExpiresByType, then ExpiresDefault should be what you want for all resources. If you did specify a type (resource), you'll have to override it also in the .htaccess Jan 9, 2011 at 16:26