-
-
Save 1000heads-luke/0b34d86076be777157a66486d0994cce to your computer and use it in GitHub Desktop.
.htaccess file for production
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
FileETag MTime Size | |
<IfModule mod_expires.c> | |
ExpiresActive on | |
# Default Cache of 1 month | |
ExpiresDefault "access 1 month" | |
# HTML - 1 month | |
ExpiresByType text/html "access 1 month" # .html | |
ExpiresByType text/xhtml+xml "access 1 month" # .xhtml | |
# Styling & Interaction - 1 year | |
# - CSS | |
ExpiresByType text/css "access 1 year" | |
# - Webfonts | |
ExpiresByType application/font-sfnt "access 1 year" # .oft, .ttf | |
ExpiresByType application/font-ttf "access 1 year" # .ttf | |
ExpiresByType application/font-woff "access 1 year" # .woff | |
ExpiresByType application/font-woff2 "access 1 year" # .woff2 | |
ExpiresByType application/vnd.ms-fontobject "access 1 year" # .eot | |
# - JS | |
ExpiresByType application/javascript "access 1 year" | |
ExpiresByType application/x-javascript "access 1 year" | |
ExpiresByType text/javascript "access 1 year" | |
# Data | |
# - RSS and ATOM - 1 hour | |
ExpiresByType application/atom+xml "access 1 hour" | |
ExpiresByType application/rdf+xml "access 1 hour" | |
ExpiresByType application/rss+xml "access 1 hour" | |
# - JSON - Immediate | |
ExpiresByType application/json "access 0 seconds" | |
ExpiresByType application/ld+json "access 0 seconds" | |
ExpiresByType application/schema+json "access 0 seconds" | |
ExpiresByType application/vnd.geo+json "access 0 seconds" | |
ExpiresByType application/xml "access 0 seconds" # .xml | |
ExpiresByType text/xml "access 0 seconds" # .xml | |
# - Manifest - JSON - 1 week | |
ExpiresByType application/manifest+json "access 1 week" | |
# - Manifest - Immediate | |
ExpiresByType application/x-web-app-manifest+json "access 0 seconds" | |
ExpiresByType text/cache-manifest "access 0 seconds" | |
# Assets - 1 year | |
# - Favicon | |
ExpiresByType image/vnd.microsoft.icon "access 1 year" | |
ExpiresByType image/x-icon "access 1 year" | |
# - Audio | |
ExpiresByType audio/ogg "access 1 year" # .ogg | |
ExpiresByType audio/mpeg "access 1 year" # .mp3 | |
ExpiresByType audio/webm "access 1 year" # .webm | |
# - Images | |
ExpiresByType image/jpeg "access 1 year" | |
ExpiresByType image/png "access 1 year" | |
ExpiresByType image/apng "access 1 year" | |
ExpiresByType image/svg+xml "access 1 year" | |
ExpiresByType image/webp "access 1 year" | |
ExpiresByType image/gif "access 1 year" | |
ExpiresByType image/bmp "access 1 year" | |
# - Video | |
ExpiresByType video/mp4 "access 1 year" # .mp4 | |
ExpiresByType video/ogg "access 1 year" # .ogg | |
ExpiresByType video/webm "access 1 year" # .webm | |
</IfModule> | |
# Webfonts | |
<FilesMatch "\.(woff2)$"> | |
<IfModule !mod_headers.c> | |
<IfModule mod_expires.c> | |
ExpiresActive On | |
ExpiresDefault "access 1 year" | |
</IfModule> | |
</IfModule> | |
<IfModule mod_headers.c> | |
Header set Cache-Control "max-age=290304000, no-transform, public" | |
Header set Expires "Tue, 20 Jan 2037 04:20:42 GMT" | |
</IfModule> | |
</FilesMatch> | |
<IfModule mod_mime.c> | |
AddType font/woff2 woff2 | |
</IfModule> | |
# Deflate | |
<IfModule mod_filter.c> | |
AddOutputFilterByType DEFLATE "application/atom+xml" \ | |
"application/rdf+xml" \ | |
"application/rss+xml" \ | |
"application/xhtml+xml" \ | |
"application/xml" \ | |
"application/javascript" \ | |
"application/json" \ | |
"application/ld+json" \ | |
"application/manifest+json" \ | |
"application/schema+json" \ | |
"application/vnd.geo+json" \ | |
"application/vnd.ms-fontobject" \ | |
"application/x-font-ttf" \ | |
"application/x-javascript" \ | |
"application/x-web-app-manifest+json" \ | |
"font/eot" \ | |
"font/opentype" \ | |
"image/svg+xml" \ | |
"image/vnd.microsoft.icon" \ | |
"image/x-icon" \ | |
"text/cache-manifest" \ | |
"text/css" \ | |
"text/html" \ | |
"text/javascript" \ | |
"text/plain" \ | |
"text/vcard" \ | |
"text/x-component" \ | |
"text/x-cross-domain-policy" \ | |
"text/xml" | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment