just got to know that setting expiry dates for static resources make your site go fast and jump in rankings.
My question is:
Does browser checks create date of the static resource?
If I make change to a css before 1 month, does server sends fresh copy and browser refreshes its cache?
This is the code I added to htaccess:
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year"
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# CSS
ExpiresByType text/css "access plus 1 month"
# Javascript
ExpiresByType application/javascript "access plus 1 year"
</IfModule>
From mod_expires documentation:
Here is the syntax:
So if you write:
Your file will be cached as long as visitors keep requesting it without interruption for more than a month, even if you modify it.
You should then write instead:
Then your file will be cached for a month as long as it is not modified, otherwise the cache will be updated.