Echtes Insider-Wissen aus 20 Jahren Webdesign-Praxis
Rennwagen als Symbol für rasend schnelle Websites

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

Schreibe einen Kommentar

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

Let us know you are human:


Verpasse nicht meinen nächsten Post

Das hier ist kein Newsletter. Sondern eine Einladung, von meinen Aha-Momenten und wichtigsten Learnings zu profitieren. Kein Funnel. Kein Marketinggeschwurbel.
Newsletter Sign-up (2025)

Let us know you are human:


Du kannst dich jederzeit wieder abmelden. Alles Weitere ist in meinen Datenschutzhinweisen.

Beiträge zu ähnlichen Themen