perf: ship Apache caching and HTTPS redirect
This commit is contained in:
1 file changed
+45
@@ -0,0 +1,45 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteCond %{HTTPS} !=on
|
||||
RewriteRule ^ https://green-tea.expressive-tea.io%{REQUEST_URI} [R=301,L,NE]
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_expires.c>
|
||||
ExpiresActive On
|
||||
ExpiresByType text/html "access plus 0 seconds"
|
||||
ExpiresByType text/css "access plus 7 days"
|
||||
ExpiresByType text/javascript "access plus 7 days"
|
||||
ExpiresByType application/javascript "access plus 7 days"
|
||||
ExpiresByType font/woff2 "access plus 1 year"
|
||||
ExpiresByType image/avif "access plus 7 days"
|
||||
ExpiresByType image/gif "access plus 7 days"
|
||||
ExpiresByType image/jpeg "access plus 7 days"
|
||||
ExpiresByType image/png "access plus 7 days"
|
||||
ExpiresByType image/svg+xml "access plus 7 days"
|
||||
ExpiresByType image/webp "access plus 7 days"
|
||||
ExpiresByType image/x-icon "access plus 7 days"
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_headers.c>
|
||||
<FilesMatch "\.html?$">
|
||||
Header set Cache-Control "public, max-age=0, must-revalidate"
|
||||
</FilesMatch>
|
||||
|
||||
<FilesMatch "\.woff2$">
|
||||
Header set Cache-Control "public, max-age=31536000"
|
||||
</FilesMatch>
|
||||
|
||||
<FilesMatch "\.(?:avif|gif|ico|jpe?g|png|svg|webp)$">
|
||||
Header set Cache-Control "public, max-age=604800"
|
||||
</FilesMatch>
|
||||
|
||||
<FilesMatch "\.[A-Za-z0-9_-]{8,}\.(?:avif|css|eot|gif|ico|jpe?g|js|mjs|otf|png|svg|ttf|webp|woff2?)$">
|
||||
Header set Cache-Control "public, max-age=31536000, immutable"
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_deflate.c>
|
||||
AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript text/xml
|
||||
AddOutputFilterByType DEFLATE application/javascript application/x-javascript application/json application/ld+json
|
||||
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/atom+xml image/svg+xml
|
||||
</IfModule>
|
||||
Reference in new issue
Block a user