Skip to content

Instantly share code, notes, and snippets.

@5AMsan
Created December 12, 2017 14:14
Show Gist options
  • Save 5AMsan/bd4c66572bcc4014be2bc179a9b00617 to your computer and use it in GitHub Desktop.
Save 5AMsan/bd4c66572bcc4014be2bc179a9b00617 to your computer and use it in GitHub Desktop.
# BEGIN Expire headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 7200 seconds"
ExpiresByType image/jpg "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType image/svg "access plus 2592000 seconds"
ExpiresByType font/woff "access plus 2592000 seconds"
ExpiresByType font/woff2 "access plus 2592000 seconds"
ExpiresByType font/eot "access plus 2592000 seconds"
ExpiresByType font/ttf "access plus 2592000 seconds"
ExpiresByType font/svg "access plus 2592000 seconds"
AddType image/x-icon .ico
ExpiresByType image/ico "access plus 2592000 seconds"
ExpiresByType image/icon "access plus 2592000 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType text/css "access plus 2592000 seconds"
ExpiresByType text/javascript "access plus 2592000 seconds"
ExpiresByType text/html "access plus 7200 seconds"
ExpiresByType application/xhtml+xml "access plus 7200 seconds"
ExpiresByType application/javascript "access plus 2592000 seconds"
ExpiresByType application/x-javascript "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
</IfModule>
# END Expire headers
# BEGIN Cache-Control Headers
<IfModule mod_headers.c>
<FilesMatch "\.(ico|jpe?g|png|gif|swf|css|gz|woff|woff2|svg|ttf|eot)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
<FilesMatch "\.(js)$">
Header set Cache-Control "max-age=2592000, private"
</FilesMatch>
<filesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=7200, public"
</filesMatch>
# Disable caching for scripts and other dynamic files
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>
</IfModule>
# END Cache-Control Headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment