Expires headers do not work

I had the same kind of problem. It seems (some) validators, like YSlow, don't succeed until the expires dates are on value 31536000.

Here's a full W3 Total Cache htaccess: http://pastebin.com/wegK3jD6.
It worked for me, you might as well give it a shot.

Note that the pastebin doesn't contain the WordPress htaccess content


The answer for me was enable expires module.

a2enmod expires
systemctl restart apache2

Answer by: Southparkfan in https://www.digitalocean.com/community/questions/how-to-setup-expire-headers-on-apache

So this code will work in apache server conf

<IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault "access plus 1 month"
    ExpiresByType text/html "access plus 15 days"
    ExpiresByType image/gif "access plus 1 months"
    ExpiresByType image/jpg "access plus 1 months"
    ExpiresByType image/jpeg "access plus 1 months"
    ExpiresByType image/png "access plus 1 months"
    ExpiresByType text/js "access plus 1 months"
    ExpiresByType text/javascript "access plus 1 months"

    ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
    ExpiresByType font/ttf "access plus 1 year"
    ExpiresByType font/otf "access plus 1 year"
    ExpiresByType font/woff "access plus 1 year"
    ExpiresByType font/woff2 "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 year"
</IfModule>

Hope that helps