Hi,
i run my latest kirby site through https://gtmetrix.com and got a not that good C rating.
Then i fiddled around with the .htaccess a little bit and added some cache and gzip rules:
# ----------------------------------------------------------------------------------------------------------------------------------------------
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year"
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/svg "access plus 1 month"
# CSS
ExpiresByType text/css "access plus 1 month"
# Javascript
ExpiresByType application/javascript "access plus 1 year"
</IfModule>
# ----------------------------------------------------------------------------------------------------------------------------------------------
<IfModule mod_headers.c>
<FilesMatch ".(js|css|xml|gz|html|woff2|woff|otf|eot|ttf|svg|jpg|png|gif|jpeg)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
# ----------------------------------------------------------------------------------------------------------------------------------------------
<IfModule mod_mime.c>
AddType application/javascript js
AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttf ttc
AddType font/opentype otf
AddType application/x-font-woff woff
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
</Ifmodule>
# ----------------------------------------------------------------------------------------------------------------------------------------------
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
</Ifmodule>
# ----------------------------------------------------------------------------------------------------------------------------------------------
Options +Multiviews
# ----------------------------------------------------------------------------------------------------------------------------------------------
#Header unset ETag
#FileETag None
and now the score looks like this:
I’m not the .htaccess pro but i’m happy with the result.
Does somebody else have more hints&hacks to speed up pageload with kirby?
best Regards,
Svnt