Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.