Echtes Insider-Wissen ohne Werbung und Gastbeiträge
Page Speed Booster

Guten PageSpeed Score mit diesen htaccess Einstellungen

Inhaltsangabe

Mit diesen htaccess Einstellungen habe ich bei statischen Websites sehr gute Erfahrungen gemacht. Probiert es aus.

1. Komprimieren der Inhalte mit Deflate nach Dateityp

				
					
# Deflate Compression by FileType
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-shockwave-flash
</IfModule>
				
			

2. Cache Ablauf auf einen Monat setzen

				
					# turns cache on for 1 month
<IfModule mod_expires.c>
 ExpiresActive On
 ExpiresByType text/css "access plus 1 month"
 ExpiresByType text/javascript "access plus 1 month"
 ExpiresByType text/html "access plus 1 month"
 ExpiresByType application/javascript "access plus 1 month"
 ExpiresByType image/gif "access plus 1 month"
 ExpiresByType image/jpeg "access plus 1 month"
 ExpiresByType image/png "access plus 1 month"
 ExpiresByType image/x-icon "access plus 1 month"
</IfModule>
<ifmodule mod_headers.c>
<filesmatch "\\.(ico|jpe?g|png|gif|swf)$">
 Header set Cache-Control "max-age=2592000, public"
</filesmatch>
<filesmatch "\\.(css)$">
 Header set Cache-Control "max-age=604800, public"
</filesmatch>
<filesmatch "\\.(js)$">
 Header set Cache-Control "max-age=216000, private"
</filesmatch>
</ifmodule>
				
			

3. Komprimieren und Caching der Inhalte mit Deflate nach Dateiendungen in einem Schritt.

Diese Variante ist alternativ für 1. und 2. anzusehen sofern keine Trennung zwischen den Dateitypen stattfinden soll.

				
					# Deflate Compression by MimeType
<IfModule mod_deflate.c>
 <FilesMatch "\.(js|jpg|jpeg|gif|png|css)$">
  ExpiresActive on
  ExpiresDefault "access plus 1 month"
  SetOutputFilter DEFLATE
 </FilesMatch>
</IfModule>
				
			

Plugin-Empfehlungen für WordPress Websites

Wenn du keine statisch programmierte Website beschleunigen willst, sondern eine WordPress Website, findest du hier meine Plugin-Empfehlungen.

Kommentare

Schreiben Sie einen Kommentar

Ihre E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Beiträge zu ähnlichen Themen

Newsletter abonnieren

Wenn du willst, schicke ich dir gern eine E-Mail, wenn ich einen neuen Beitrag veröffentliche. Es kommt kein Spam. Nur nützliche Infos und Freebies für Menschen mit Websites. Versprochen.

Newsletter Sign-up
Ich nutze keinen externen Anbieter und speichere und nutze deine Daten ausschließlich, wie in meinen Datenschutzhinweisen beschrieben. Du kannst dich jederzeit wieder abmelden.

Willst du meinen Newsletter?

Verpasse keine neuen Posts oder Freebies. Ich versende max. einen Newsletter im Monat. Kein Spam. Versprochen.

Newsletter Sign-up
Ich speichere und nutze deine Daten ausschließlich wie in meinen Datenschutzhinweisen beschrieben. Du kannst dich jederzeit wieder abmelden.