Typical Expiration / Cache Directives for Websites
Expire static content a week or more into the future.
In .htaccess
# Turn on the module.
ExpiresActive on
# Set the default expiry times.
ExpiresDefault "now"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/svg+xml "access 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType image/ico "access plus 1 month"
ExpiresByType text/html "access plus 600 seconds"
What about site updates?
Cache/Expiration based on full URL. So you can reflect the "version" within the URL, either as part of the path or part of the query string.
- Unique "version" content in query string
https://www[...]/site.min.css?ver=f1b2b77c823860edee8f0d253d01aaed
orhttps://www[...]/site.css?ver=20220701
- versioning as part of path
- jQuery 3.6.0:
https://code.jquery.com/jquery-3.6.0.min.js
- jQuery 2.2.4:
https://code.jquery.com/jquery-2.2.4.min.js
- jQuery 3.6.0: