Seite 1 von 1
Google Pagespeed
Verfasst: Mi 25. Mai 2022, 08:55
von markus.miederer
Hallo,
möchte gerne meine fertige webEditon Website noch hinsichtlich des Pagespeed Optimieren.
Geht um diesen Punkt:
Statische Inhalte mit einer effizienten Cache-Richtlinie bereitstellen
Wäre sehr nett wenn mir kurz jemand einen Tip geben könnte.
LG
Markus
Re: Google Pagespeed
Verfasst: Mi 25. Mai 2022, 09:16
von mokraemer
ich vermute das zielt auf
https://httpd.apache.org/docs/current/m ... pires.html ab. Damit statische Inhalte länger im Cache liegen. Ich nutze das für Bilder, js, css, aber auch für statische html-Seiten.
Re: Google Pagespeed
Verfasst: Mi 25. Mai 2022, 10:06
von WBTMagnum
Hallo Markus,
Das kann dann z.B. wie folgt aussehen:
Code: Alles auswählen
<IfModule mod_expires.c>
### turn on the Expires engine
ExpiresActive On
### expires after a month in the client's cache
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/png A2592000
ExpiresByType image/svg+xml A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
</IfModule>
Je nach Site und Server sollte die Liste angepasst werden. Am Besten die Response Header der Ressourcen prüfen und ggf. fehlende MIME Types aufnehmen.
HTH,
Sascha
Re: Google Pagespeed
Verfasst: Mi 25. Mai 2022, 10:20
von markus.miederer
Hallo Sascha,
und danke für die schnelle Antwort. Hiermal meine komplette htaccess die ich so auch bei meinen sonstigen Contao
Projekten einsetze.
Code: Alles auswählen
<IfModule mod_deflate.c>
#<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
#</IfModule>
</IfModule>
AddEncoding gzip .gz
<FilesMatch "\.js\.gz$">
AddType "application/javascript" .gz
</FilesMatch>
<FilesMatch "\.css\.gz$">
AddType "text/css" .gz
</FilesMatch>
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME} \.(js|css)$
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)$ $1.gz [QSA,L]
<IfModule mod_expires.c>
### turn on the Expires engine
ExpiresActive On
### expires after a month in the client's cache
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/png A2592000
ExpiresByType image/svg+xml A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
</IfModule>
Leider zeigt Pagespeed immer noch die gleichen 32 Fehler, siehe Screen
Re: Google Pagespeed
Verfasst: Mi 25. Mai 2022, 14:00
von WBTMagnum
Hallo Markus,
Wie geschrieben, am Besten die Response Header der Ressourcen prüfen und die Liste der zu berücksichtigenden MIME Types aktualisieren.
Liebe Grüße,
Sascha
Re: Google Pagespeed
Verfasst: Mi 25. Mai 2022, 14:54
von mokraemer
ich finde diese Schreibweise aber lesbarer: