Mit htaccess WordPress Ladezeit verbessern

Webseiten Performance

Die Performance von Webseiten gehört mit zu den wichtigsten Usability Faktoren. Glücklicherweise lassen sich auf Apache Webservern mit ein paar Handgriffen die Ladezeiten verbessern. Dies geschieht durch die htaccess, einer Konfigurationsdatei für den Apache. Mit nur ein paar Einträgen in der htaccess können teilweise erhebliche Verbesserungen bei der Ladegeschwindigkeit der Webseite erzielt werden. Bauen Sie einfach nachfolgenden Code in die htaccess im Stammverzeichnis Ihrer Website ein.

 

Website-Performance verbessern mit htaccess

Gzip Komprimierung aktivieren

Apache Webserver sind mit starken Komprimierungstools ausgerüstet, die erheblich zur Verbesserung der Ladezeiten beitragen können, vor allem bei der Komprimierung von Textdateien. Eine Reduzierung der Dateigrößen von 70% und mehr sind dabei keine Seltenheit. Versuchen Sie gzip mit folgendem Code in Ihrer htaccess zu aktivieren.

# ———————————————————————-
# | Komprimierung |
# ———————————————————————-
<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>

 

Caching steuern mit Expire Headers

Viele Dateien, die beim Aufruf einer Webseiten übertragen werden, sind statische Ressourcen. Das bedeutet, sie bleiben bei jedem Seitenaufruf gleich und ändern sich nicht. Dazu gehören unter anderem. Bilder, Grafiken, Javascript- und CSS-Dateien. Es wäre ineffizient, wenn Nutzer bei jedem Besuch der Website sämtliche Dateien erneut herunterladen müssten. Stattdessen kann man einen Browser anweisen, die statischen Ressourcen einer Website im Cache abzulegen. Gesteuert wird dieses Caching mit Expire Headers in der htaccess.

# ———————————————————————-
# | Expire headers |
# ———————————————————————-

<IfModule mod_expires.c>

ExpiresActive on
ExpiresDefault „access plus 1 month“
ExpiresByType text/css „access plus 1 month“
ExpiresByType application/atom+xml „access plus 1 hour“
ExpiresByType application/rdf+xml „access plus 1 hour“
ExpiresByType application/rss+xml „access plus 1 hour“
ExpiresByType application/json „access plus 0 seconds“
ExpiresByType application/ld+json „access plus 0 seconds“
ExpiresByType application/schema+json „access plus 0 seconds“
ExpiresByType application/vnd.geo+json „access plus 0 seconds“
ExpiresByType application/xml „access plus 0 seconds“
ExpiresByType application/pdf „access 1 month“
ExpiresByType text/xml „access plus 0 seconds“
ExpiresByType image/vnd.microsoft.icon „access plus 1 week“
ExpiresByType image/x-icon „access plus 1 month“
ExpiresByType text/html „access plus 0 seconds“
ExpiresByType application/javascript „access plus 1 year“
ExpiresByType application/x-javascript „access plus 1 month“
ExpiresByType text/javascript „access plus 1 month“
ExpiresByType application/manifest+json „access plus 1 year“
ExpiresByType application/x-web-app-manifest+json „access plus 0 seconds“
ExpiresByType text/cache-manifest „access plus 0 seconds“
ExpiresByType audio/ogg „access plus 1 month“
ExpiresByType image/bmp „access plus 1 month“
ExpiresByType image/gif „access plus 1 year“
ExpiresByType image/jpeg „access plus 1 year“
ExpiresByType image/jpg „access 1 year“
ExpiresByType image/png „access plus 1 year“
ExpiresByType image/svg+xml „access plus 1 month“
ExpiresByType video/mp4 „access plus 1 month“
ExpiresByType video/ogg „access plus 1 month“
ExpiresByType video/webm „access plus 1 month“
ExpiresByType application/vnd.ms-fontobject „access plus 1 month“
ExpiresByType font/eot „access plus 1 month“
ExpiresByType font/opentype „access plus 1 month“
ExpiresByType application/x-font-ttf „access plus 1 month“
ExpiresByType application/font-woff „access plus 1 month“
ExpiresByType application/x-font-woff „access plus 1 month“
ExpiresByType font/woff „access plus 1 month“
ExpiresByType application/font-woff2 „access plus 1 month“
ExpiresByType text/x-cross-domain-policy „access plus 1 week“

</IfModule>

 

Etags entfernen

Etags (Entity Tags) wurden ursprünglich mit HTTP 1.1 eingeführt, um das Caching besser kontrollieren zu können. In der Praxis erwiesen sich ETags jedoch als problematisch. Daher ist die allgemein empfohlene Vorgehensweise, ETags komplett zu entfernen.

# ———————————————————————-
# | ETags |
# ———————————————————————-

<IfModule mod_headers.c>
Header unset ETag
</IfModule>

 

Connection keep-alive aktivieren

Die Datenübertragung auf keep-alive zu setzen ermöglicht es, mehrere Dateien über eine Verbindung zu laden. Ohne „keep-alive“ müsste der Browser für jede einzelne angeforderte Datei eine eigene Verbindung zum Webserver öffnen, was den Datentransfer verlangsamt.

# ———————————————————————-
# | Keep alive |
# ———————————————————————-
<ifModule mod_headers.c>
Header set Connection keep-alive
</ifModule>

Web Programming Dream Web Visions
Warum Dream Web Visions als Werbeagentur?
Besser jedem das Richtige als allen das gleiche. Bei einem persönlichen Gespräch erarbeiten wir mit Ihnen ein maßgeschneidertes Angebot auf Ihre Bedürfnisse abgestimmt aus.
Elementor
Elementor: #1 WordPress Page Builder
Erstellen Sie makellose Websites mit Elementor Page Builder. Außergewöhnliche UX Komponenten, Design und High Performance definieren Elementor.
  • All
  • Branding
  • Customizer
  • Design
  • DTF-Transferdruck
  • Hosting
  • Marketing
  • Merchandise
  • Mode Design
  • Page Builder
  • Performance
  • Plugins
  • Security
  • SEO
  • Textildruck
  • Theme
  • Transferdruck
  • Woocomerce
  • WordPress
Suki Theme Logo
Brizy WordPress Page Builder: Perfekt für Landing Pages
Durch das Preis Leistungsverhältnis, sowie der Kompatibilität zu Zahlreichen Tools, Themes & Plugins, sowie der Performance bei kleineren Seiten ist der Brizy Page Builder der perfekte Weg zur Umsetzung Ihrer Landing Page.