问题原文
原帖链接 · pee2pee · CC BY-SA 3.0
Just setup a Wordpress site on an using an Amazon EC2 Bitnami AMI. I've ran the usual suspects of speed tests and have added this to my .htaccess file, like I've done dozens of times before:
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##
However I still get the issues around saying I should leverage browser caching. Apache has restarted and even the server has been rebooted but same happens. I've checked the Apache2 config file and the mod_expires module is present (I'm 99% sure it is!)
Anything I'm missing that is maybe specific to Amazon EC2 and/or Bitnami Wordpress?
Standard Bitnami AMI... Linux version 3.13.0-100-generic
已采纳解答
原帖链接 · Stephen Ostermiller · CC BY-SA 3.0
There appear to be two things you need to check.
First edit /opt/bitnami/apache2/conf/httpd.conf and make sure that the line loading mod_expires is not commented out (comments start with #). If it is, uncomment it and restart Apache. (source)
If you are trying to set the expires headers in .htaccess you will also have to allow overrides in your Apache configuration. Edit httpd.conf and make sure that allowoverride all is specified. (source)
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
