I want to set expiration headers for all the files in a "media" folder. A file looks like this: media/css/db38a57a8fa9de240b3ed5eb8be83691
. I want it to be served with headers specifying it is to expire i开发者_StackOverflow社区n a year or more.
How do I do that with .htaccess?
First , is mod_expire enabled in apache ? you can setup expiration like this if it's enabled
<ifmodule mod_expires.c>
ExpiresDefault "modification plus 1 year"
</ifmodule>
Files will expire 1 year after they have been last modified , if you whant it based on access you can set it like so :
<ifmodule mod_expires.c>
ExpiresDefault "access plus 1 year"
</ifmodule>
Have a look here.
精彩评论