0

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?

3

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? – Tom Jan 9 '11 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 – DTest Jan 9 '11 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.