Created
June 10, 2020 10:43
-
-
Save vanpariyar/e0aa64a09e19b162b47dbaf12230b311 to your computer and use it in GitHub Desktop.
Leverage Browser Caching
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
| <ifModule mod_gzip.c> | |
| mod_gzip_on Yes | |
| mod_gzip_dechunk Yes | |
| mod_gzip_item_include file .(html?|txt|css|js|php|pl)$ | |
| mod_gzip_item_include handler ^cgi-script$ | |
| mod_gzip_item_include mime ^text/.* | |
| mod_gzip_item_include mime ^application/x-javascript.* | |
| mod_gzip_item_exclude mime ^image/.* | |
| mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* | |
| </ifModule> | |
| # Leverage Browser Caching | |
| <IfModule mod_expires.c> | |
| AddType image/x-icon ico | |
| AddType image/webp webp | |
| ExpiresActive On | |
| ExpiresByType image/jpg "access 1 year" | |
| ExpiresByType image/jpeg "access 1 year" | |
| ExpiresByType image/gif "access 1 year" | |
| ExpiresByType image/png "access plus 1 year" | |
| ExpiresByType image/webp "access plus 1 year" | |
| ExpiresByType image/svg+xml "access plus 1 year" | |
| ExpiresByType image/bnd.microsoft.icon "access plus 1 year" | |
| ExpiresByType image/x-icon "access plus 1 year" | |
| ExpiresByType text/css "access 1 year" | |
| ExpiresByType text/html "access 1 month" | |
| ExpiresByType video/ogg "access plus 1 year" | |
| ExpiresByType audio/ogg "access plus 1 year" | |
| ExpiresByType video/mp4 "access plus 1 year" | |
| ExpiresByType video/webm "access plus 1 year" | |
| ExpiresByType image/svg+xml "access plus 1 year" | |
| ExpiresByType application/vnd.ms-fontobject "access plus 1 year" | |
| ExpiresByType text/javascript "access 1 year" | |
| ExpiresByType application/pdf "access 1 month" | |
| ExpiresByType application/javascript "access 1 year" | |
| ExpiresByType application/x-javascript "access 1 year" | |
| ExpiresByType text/x-javascript "access 1 year" | |
| ExpiresByType application/x-shockwave-flash "access 1 month" | |
| ExpiresByType image/x-icon "access plus 1 year" | |
| ExpiresDefault "access plus 1 month" | |
| </IfModule> | |
| <IfModule mod_expires.c> | |
| # Fonts | |
| # 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 | |
| # only uncomment if you dont have compression turned on already. Otherwise it will cause all other filestypes not to get compressed | |
| # AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-opentype image/svg+xml | |
| ExpiresActive on | |
| # 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> | |
| <IfModule mod_headers.c> | |
| <filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf|svg)$"> | |
| Header set Cache-Control "max-age=32140800, public" | |
| </filesmatch> | |
| <filesMatch "\.(x?html?)$"> | |
| Header set Cache-Control "max-age=7200, private, must-revalidate" | |
| </filesmatch> | |
| <filesmatch "\.(pdf)$"> | |
| Header set Cache-Control "max-age=86400, public" | |
| </filesmatch> | |
| <filesmatch "\.(js)$"> | |
| Header set Cache-Control "max-age=2678400, private" | |
| </filesmatch> | |
| </IfModule> | |
| <IfModule mod_deflate.c> | |
| # Compress HTML, CSS, JavaScript, Text, XML and fonts | |
| AddOutputFilterByType DEFLATE application/javascript | |
| AddOutputFilterByType DEFLATE application/rss+xml | |
| AddOutputFilterByType DEFLATE application/vnd.ms-fontobject | |
| AddOutputFilterByType DEFLATE application/x-font | |
| AddOutputFilterByType DEFLATE application/x-font-opentype | |
| AddOutputFilterByType DEFLATE application/x-font-otf | |
| AddOutputFilterByType DEFLATE application/x-font-truetype | |
| AddOutputFilterByType DEFLATE application/x-font-ttf | |
| AddOutputFilterByType DEFLATE application/x-javascript | |
| AddOutputFilterByType DEFLATE application/xhtml+xml | |
| AddOutputFilterByType DEFLATE application/xml | |
| AddOutputFilterByType DEFLATE font/opentype | |
| AddOutputFilterByType DEFLATE font/otf | |
| AddOutputFilterByType DEFLATE font/ttf | |
| AddOutputFilterByType DEFLATE image/svg+xml | |
| AddOutputFilterByType DEFLATE image/x-icon | |
| AddOutputFilterByType DEFLATE text/css | |
| AddOutputFilterByType DEFLATE text/html | |
| AddOutputFilterByType DEFLATE text/javascript | |
| AddOutputFilterByType DEFLATE text/plain | |
| AddOutputFilterByType DEFLATE text/xml | |
| </IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment