56 lines
1.9 KiB
ApacheConf
56 lines
1.9 KiB
ApacheConf
# KH3 Website Performance Optimization
|
|
# Cache static assets for better performance
|
|
|
|
# Enable compression
|
|
<IfModule mod_deflate.c>
|
|
AddOutputFilterByType DEFLATE text/plain
|
|
AddOutputFilterByType DEFLATE text/html
|
|
AddOutputFilterByType DEFLATE text/xml
|
|
AddOutputFilterByType DEFLATE text/css
|
|
AddOutputFilterByType DEFLATE application/xml
|
|
AddOutputFilterByType DEFLATE application/xhtml+xml
|
|
AddOutputFilterByType DEFLATE application/rss+xml
|
|
AddOutputFilterByType DEFLATE application/javascript
|
|
AddOutputFilterByType DEFLATE application/x-javascript
|
|
AddOutputFilterByType DEFLATE image/svg+xml
|
|
</IfModule>
|
|
|
|
# Cache static assets
|
|
<IfModule mod_expires.c>
|
|
ExpiresActive On
|
|
|
|
# Images
|
|
ExpiresByType image/jpg "access plus 1 month"
|
|
ExpiresByType image/jpeg "access plus 1 month"
|
|
ExpiresByType image/gif "access plus 1 month"
|
|
ExpiresByType image/png "access plus 1 month"
|
|
ExpiresByType image/svg+xml "access plus 1 month"
|
|
ExpiresByType image/webp "access plus 1 month"
|
|
|
|
# CSS and JavaScript
|
|
ExpiresByType text/css "access plus 1 month"
|
|
ExpiresByType application/javascript "access plus 1 month"
|
|
ExpiresByType application/x-javascript "access plus 1 month"
|
|
|
|
# Fonts
|
|
ExpiresByType font/woff "access plus 1 year"
|
|
ExpiresByType font/woff2 "access plus 1 year"
|
|
ExpiresByType application/font-woff "access plus 1 year"
|
|
ExpiresByType application/font-woff2 "access plus 1 year"
|
|
|
|
# HTML (shorter cache for dynamic content)
|
|
ExpiresByType text/html "access plus 1 hour"
|
|
</IfModule>
|
|
|
|
# Add cache control headers
|
|
<IfModule mod_headers.c>
|
|
# Cache static assets
|
|
<FilesMatch "\.(css|js|png|jpg|jpeg|gif|svg|woff|woff2)$">
|
|
Header set Cache-Control "public, max-age=2592000"
|
|
</FilesMatch>
|
|
|
|
# Cache HTML for shorter time
|
|
<FilesMatch "\.(html|htm)$">
|
|
Header set Cache-Control "public, max-age=3600"
|
|
</FilesMatch>
|
|
</IfModule>
|