2

Somehow I need to confirm how htaccess expires headers works when used in the home directory as well as subdirectories.

Let's say I have this in the home directory's htaccess:

ExpiresActive On 
ExpiresByType image/gif "access plus 1 month"

Then let's say I have this in an htaccess in a /thumbnails/ subdirectory:

ExpiresActive On 
ExpiresByType image/gif "access plus 1 year"

So globally on the site, GIF images are meant to cache for a month, but for the /thumbnails/ directory, GIF images are meant to cache for a year. Am I correct in assuming that the htaccess in the /thumbnails/ directory will override the htaccess in the home directory? Or is it vice versa? Any documentation confirming as such?

user1610904
  • 397
  • 3
  • 20

1 Answers1

1

Your assumption is correct. The Apache's documentation for any directive consists of a section called Context.

The precedence follow the rules base on AllowOverride directive. If your server is configured to allow overriding for the Expires module, then the configuration from /thumbnails/ will take precedence.

hjpotter92
  • 78,589
  • 36
  • 144
  • 183