I am currently trying to improve website loading times and I am using the following:
<IfModule mod_expires.c>
############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "Thu, 15 Apr 2020 20:00:00 GMT"
</FilesMatch>
</IfModule>
That works great … I was wondering if it is possible not to have a fixed date there. Can I do something like this?
<IfModule mod_expires.c>
############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
</IfModule>
Doesn’t seem to work ATM :S
Thanks
Regards
Gabriel
To enable
ExpiresDefault, you need to setExpiresActivetoonas in:The above answer should solve your question. For other cases:
mod_expiresis not a default Apache module, it’s an extension. Make sure that it is enabled, which you can do usingphpinfo()on a PHP-enabled server. If you have shell access, you can runapachectl -t -D DUMP_MODULES.