Folgender Code in die .htaccess

Beachten: je nach Hoster/Server-Konfiguration können manche Einstellungen zu einem 500 Internal Server Error führen. Hier dann einfach nach und nach Code-Blöcke aktivieren/deaktivieren, um den „schuldigen“ zu finden.

# mod_deflate gzip compression
<IfModule mod_deflate.c>
  <FilesMatch "\.(js|css)$">
    SetOutputFilter DEFLATE
  </FilesMatch>
</IfModule>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
AddOutputFilterByType DEFLATE application/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
Header set Vary Accept-Encoding
 
 
# browser-caching with mod_expires and mod_headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 8 days"
ExpiresByType text/html "access plus 30 second"
ExpiresByType text/php "access plus 30 second"
ExpiresByType text/css "access plus 100 days"
ExpiresByType image/gif "access plus 8 days"
ExpiresByType image/jpeg "access plus 8 days"
ExpiresByType image/jpg "access plus 8 days"
ExpiresByType image/png "access plus 8 days"
ExpiresByType image/bmp "access plus 8 days"
ExpiresByType application/x-shockwave-flash "access plus 100 days"
ExpiresByType application/javascript "access plus 100 days"
ExpiresByType application/x-javascript "access plus 100 days"
ExpiresByType image/x-icon "access plus 100 days"
</IfModule>
 
<IfModule mod_headers.c>
<filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=1004800,public"
</filesMatch>
</IfModule>
 
# Removal of ETag
FileETag MTime Size
<IfModule mod_headers.c>
FileETag none
</IfModule>