I've been unable to successfully get a client's website to set expires. They're running a bitnami cloud image on an EC2 instance. Things I've tried:
- 1. Loading the mod_expires module into apache with httpd.conf
- Specifically: "LoadModule expires_module modules/mod_expires.so"
- 2. Using the wordpress plugin "W3 Total Cache"
- This plugin fails to detect the mod_expires module, but I am fairly sure that it ships with bitnami
- 3. editing .htaccess directly
- Using ExpiresActive On ExpiresDefault "access plus 90 days"
- 4. The tutorial here: http://www.theitbaby.com/wordpress/2013/10/14/optimizing-bitnami-for-pagespeed-insights-and-gtmetrix/
Strangely, apache complains when I use the code provided in the above mentioned tutorial gives me an error saying that ExpiresByType takes two arguments. When I change "access plus 9 months" to "A2592000" it seems to go back to working.
I'm out of options left to try and low on hope. Any ideas?
Solution: 1) configure .htaccess to use mod_expires [as can be seen here]http://www.inmotionhosting.com/support/website/htaccess/apache-module-mod-expires) 2) change httpd-app.conf to use AllowOverride All
Setting "AllowOverride All" presents a security issue and should be avoided. I solved the same problem by using "seconds code" syntax, although I can't explain why the alternative syntax did not work.
Use A7776000 instead of "access plus 3 months"
Example: