Last active
February 5, 2018 21:47
-
-
Save EastSideCode/0b4b8ec4c8d5d2b94e8c718c514e14f1 to your computer and use it in GitHub Desktop.
Leverage browser caching with .htaccess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## EXPIRES CACHING ## | |
# In apache, be sure to enable mod_headers and mod_expires | |
# sudo a2enmod headers | |
# sudo a2enmod expires | |
# | |
# Then restart apache | |
# service apache2 restart | |
<IfModule mod_expires.c> | |
ExpiresActive On | |
ExpiresByType image/jpg "access 1 year" | |
ExpiresByType image/jpeg "access 1 year" | |
ExpiresByType image/gif "access 1 year" | |
ExpiresByType image/png "access 1 year" | |
ExpiresByType text/css "access 1 month" | |
ExpiresByType application/pdf "access 1 month" | |
ExpiresByType text/js "access plus 1 years" | |
ExpiresByType text/javascript "access plus 1 years" | |
ExpiresByType application/javascript "access plus 1 years" | |
ExpiresByType application/x-javascript "access plus 1 years" | |
ExpiresByType application/x-shockwave-flash "access 1 month" | |
ExpiresByType image/x-icon "access 1 year" | |
ExpiresDefault "access 2 days" | |
</IfModule> | |
## EXPIRES CACHING ## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment