Search code examples
caching.htaccessproxyperformancecache-control

ExpiresDefault: difference between Access and Modificaion?


I have been trying to decode the actual, benefitial differences between the Access and Modification, when setting Cache control in Apache's .htaccess, when to use which, but find the Apache documentation too technical for my understanding.

Basically, I want to use a method that gives me good fast caching. Can someone explain the advantages of using access as opposed to modification? When to use which?

Does A7200 mean "keep 2 hours after last user accessed it"?

ExpiresDefault "access plus 10 years"

Does M7200 mean "keep 2 hours after the file was modified on server"?

ExpiresDefault "modification plus 10 years"

I have a bunch of dynamic files (php|htm) and a bunch of static files (ico|jpg|png|gif|svg|swf|css|js|fon|ttf|eot|xml|pdf|flv) and cannot make up my mind what to do. Thanks very much for clarification.


Solution

  • Access refers to the last time a client's web browser requested the file Modification refers to the last time the webpage changed (HTML) or was generated (PHP)

    If you say Expiresdefault "access plus 2 days" it means that when a user downloads a file from Apache, that file stays in the Apache cache for 2 days unless another user requests the same file and on and on...

    Access plus 2 days should be good enough, 10 years seems very excessive.