Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted

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.

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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