Created
September 22, 2018 04:56
-
-
Save jekayode/797e6545667e22f8f585862846ab4201 to your computer and use it in GitHub Desktop.
Leverage Browser Caching #browsercaching #optimization #htaccess
This file contains hidden or 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
| ## LEVERAGE BROWSER CACHING ## | |
| <IfModule mod_expires.c> | |
| ExpiresActive On | |
| # Add correct content-type for fonts | |
| AddType application/vnd.ms-fontobject .eot | |
| AddType application/x-font-ttf .ttf | |
| AddType application/x-font-opentype .otf | |
| AddType application/x-font-woff .woff | |
| AddType image/svg+xml .svg | |
| # Compress compressible fonts | |
| AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-opentype image/svg+xml | |
| # Common Types | |
| 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 text/javascript "access 1 month" | |
| ExpiresByType text/html "access 1 month" | |
| ExpiresByType application/pdf "access 1 month" | |
| ExpiresByType application/x-javascript "access 1 month" | |
| ExpiresByType application/javascript "access 1 month" | |
| ExpiresByType application/x-shockwave-flash "access 1 month" | |
| ExpiresByType image/x-icon "access 1 year" | |
| ExpiresDefault "access 2 days" | |
| # Add a far future Expires header for fonts | |
| ExpiresByType application/vnd.ms-fontobject "access plus 1 year" | |
| ExpiresByType application/x-font-ttf "access plus 1 year" | |
| ExpiresByType application/x-font-opentype "access plus 1 year" | |
| ExpiresByType application/x-font-woff "access plus 1 year" | |
| ExpiresByType image/svg+xml "access plus 1 year" | |
| </IfModule> | |
| ## LEVERAGE BROWSER CACHING ## | |
| ## BEGIN Disable ETag header ## | |
| Header unset Pragma | |
| Header unset ETag | |
| FileETag None | |
| ## END Disable ETag header ## | |
| ## BEGIN Vary: Accept-Encoding Header ## | |
| <IfModule mod_headers.c> | |
| <FilesMatch "\.(js|css|xml|gz)$"> | |
| Header append Vary: Accept-Encoding | |
| </FilesMatch> | |
| </IfModule> | |
| ## END Vary: Accept-Encoding Header ## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment