Skip to content

Instantly share code, notes, and snippets.

@iconifyit
Last active July 2, 2019 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iconifyit/535d4e29734ac7c8e9724142475b2dfd to your computer and use it in GitHub Desktop.
Save iconifyit/535d4e29734ac7c8e9724142475b2dfd to your computer and use it in GitHub Desktop.
Typical Expires, Etag, and Cache-control for Google Site Speed Test best results
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
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 ##
## Etags
Header unset ETag
FileETag None
## Etags
## CSS caching
<filesMatch ".(css)$">
Header set Cache-Control "max-age=31536000, public"
</filesMatch>
## JS caching
<filesMatch ".(js)$">
Header set Cache-Control "max-age=2628000, private"
</filesMatch>
## Image caching
<filesMatch ".(jpg|jpeg|png|gif|ico)$">
Header set Cache-Control "max-age=86400, public"
</filesMatch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment