I have an F on Yslow, because of expired headers.
I have tried all the solutions from similar question and only got partial success.
Here's my .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
<IfModule mod_expires.c>
### activate mod_expires
ExpiresActive On
### Expire .gif’s 1 month from when they’re accessed (Default algorithm)
ExpiresByType image/gif A2592000
### Expire .jpg’s 1 month from when they’re accessed
ExpiresByType image/jpg A2592000
### Expire .png’s 1 month from when they’re accessed
ExpiresByType image/png A2592000
### Expire .js’s 7 days from when they’re accessed (Alternative algorithm)
ExpiresByType text/js "access plus 7 days"
### Expire .css’s 30 days from when they’re accessed
ExpiresByType text/css "access plus 30 days"
### Expire everything else 1 day from when it’s last modified
ExpiresDefault "modification plus 1 day"
</IfModule>
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
<IfModule mod_setenvif.c>
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
</IfModule>
<IfModule mod_headers.c>
<filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf)$">
Header set Cache-Control "max-age=2678400, public"
</filesmatch>
<filesmatch "\.(html|htm)$">
Header set Cache-Control "max-age=7200, private, must-revalidate"
</filesmatch>
<filesmatch "\.(pdf)$">
Header set Cache-Control "max-age=86400, public"
</filesmatch>
<filesmatch "\.(js)$">
Header set Cache-Control "max-age=2678400, private"
</filesmatch>
</IfModule>
</IfModule>
# END WordPress
ExpiresByType
items? If so you should add them outside the section labeled as handled by WordPress. WordPress may just overwrite everything in that section. – Stephen Ostermiller♦ Sep 30 '16 at 11:27