Last active
May 7, 2021 20:33
-
-
Save tavy315/8220a6f86a10e107738bc5fb84af4627 to your computer and use it in GitHub Desktop.
Enable GZip compression & Leverage browser caching
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
AddDefaultCharset UTF-8 | |
Options -Indexes | |
<IfModule mod_deflate.c> | |
AddOutputFilterByType DEFLATE application/javascript | |
AddOutputFilterByType DEFLATE application/json | |
AddOutputFilterByType DEFLATE application/x-javascript | |
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject | |
AddOutputFilterByType DEFLATE font/ttf | |
AddOutputFilterByType DEFLATE font/otf | |
AddOutputFilterByType DEFLATE image/svg+xml | |
AddOutputFilterByType DEFLATE text/css | |
AddOutputFilterByType DEFLATE text/javascript | |
AddOutputFilterByType DEFLATE text/plain | |
AddOutputFilterByType DEFLATE text/html | |
AddOutputFilterByType DEFLATE text/xml | |
</IfModule> | |
<IfModule mod_mime.c> | |
AddType font/opentype .otf | |
AddType application/font-woff .woff | |
AddType application/font-woff2 .woff2 | |
AddType application/x-font-ttf .ttf | |
AddType application/vnd.ms-fontobject .eot | |
AddType image/svg+xml .svg | |
</IfModule> | |
<IfModule mod_expires.c> | |
ExpiresActive On | |
ExpiresDefault "access plus 1 seconds" | |
ExpiresByType application/javascript "access plus 6 months" | |
ExpiresByType application/vnd.ms-fontobject "access plus 6 months" | |
ExpiresByType application/xhtml+xml "access plus 10 minutes" | |
ExpiresByType application/x-javascript "access plus 6 months" | |
ExpiresByType application/x-shockwave-flash "access plus 6 months" | |
ExpiresByType application/x-woff "access plus 6 months" | |
ExpiresByType application/x-woff2 "access plus 6 months" | |
ExpiresByType font/otf "access plus 6 months" | |
ExpiresByType font/ttf "access plus 6 months" | |
ExpiresByType image/gif "access plus 6 months" | |
ExpiresByType image/jpeg "access plus 6 months" | |
ExpiresByType image/png "access plus 6 months" | |
ExpiresByType image/svg+xml "access plus 6 months" | |
ExpiresByType image/x-icon "access plus 6 months" | |
ExpiresByType text/css "access plus 6 months" | |
ExpiresByType text/html "access plus 10 minutes" | |
ExpiresByType text/javascript "access plus 6 months" | |
ExpiresByType video/x-flv "access plus 6 months" | |
</IfModule> | |
<IfModule mod_headers.c> | |
<FilesMatch "\\.(ico|jpe?g|png|gif|swf)$"> | |
Header set Cache-Control "max-age=14515200, public" | |
</FilesMatch> | |
<FilesMatch "\\.(css)$"> | |
Header set Cache-Control "max-age=14515200, public" | |
</FilesMatch> | |
<FilesMatch "\\.(js)$"> | |
Header set Cache-Control "max-age=14515200, public" | |
</FilesMatch> | |
<FilesMatch "\.(ttf|otf|eot|woff|woff2|svg)$"> | |
Header set Cache-Control "max-age=14515200, public" | |
</FilesMatch> | |
#Header unset ETag | |
#Header unset Last-Modified | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add "ExpiresByType application/x-woff2 "access plus 6 months"" inside ""..."" will solve