Skip to content

Instantly share code, notes, and snippets.

@mmh4560
Created October 21, 2018 11:51
Show Gist options
  • Save mmh4560/9906fcdd4f8a8df86c482d4c8aa0f664 to your computer and use it in GitHub Desktop.
Save mmh4560/9906fcdd4f8a8df86c482d4c8aa0f664 to your computer and use it in GitHub Desktop.
Leverage Browser Caching
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)\.html$ $1.html [nc]
RewriteCond %{HTTP_HOST} !^www.greatamericanautotransportation.com$ [NC]
RewriteRule ^(.*)$ http://www.greatamericanautotransportation.com$1 [L,R=301]
</IfModule>
# BEGIN EXPIRES
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 10 days"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/plain "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType application/x-icon "access plus 1 year"
</IfModule>
# END EXPIRES
<IfModule mod_headers.c>
<FilesMatch "\.(js|css|xml|gz)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
<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>
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml text/x-js text/js
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment