• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

[ERLEDIGT] GZIP für SVG, CSS und JS Datein klappt nicht

Status
Für weitere Antworten geschlossen.

blubb216

Neues Mitglied
Hallo Ihr Lieben,

ich beschäftige mich gerade mit der Komprimierung meiner Homepage und komme einfach nicht weiter
icon_frown.gif


Es geht um die Fehlermeldung bei der Komprimierung von SVG, CSS und JS Datein. Fehlermeldung kommt

Komprimierung aktivieren
Durch die Komprimierung der Ressourcen mit "gzip" oder "deflate" kann die Anzahl der über das Netzwerk gesendeten Bytes reduziert werden.
Ermöglichen Sie die Komprimierung der folgenden Ressourcen, um die Übertragungsgröße um 170 KB (72 %) zu reduzieren.

Code:
/js/jquery-1.11.3.min.js
/js/bootstrap.js
/bcss/bootstrap.css
/Logo_final.svg

GZIP ist aktiviert und in der .htaccess steht nach etlichen Versuchen nun:
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ [URL]http://www.%[/URL]{HTTP_HOST}/$1 [R=301,L]
  

<FilesMatch "\.(css|htc|js|js2|js3|js4|CSS|HTC|JS|JS2|JS3|JS4)$">
 FileETag MTime Size
 <IfModule mod_headers.c>
 Header set Pragma "public"
 Header append Cache-Control "public"
 Header unset Set-Cookie
 </IfModule>
</FilesMatch>

<FilesMatch "\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|SVG|SVGZ|TXT|XSD|XSL|XML)$">
 FileETag MTime Size
 <IfModule mod_headers.c>
 Header set Pragma "public"
 Header append Cache-Control "public"
 </IfModule>
</FilesMatch>

<FilesMatch "\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip|ASF|ASX|WAX|WMV|WMX|AVI|BMP|CLASS|DIVX|DOC|DOCX|EOT|EXE|GIF|GZ|GZIP|ICO|JPG|JPEG|JPE|JSON|MDB|MID|MIDI|MOV|QT|MP3|M4A|MP4|M4V|MPEG|MPG|MPE|MPP|OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|PNG|POT|PPS|PPT|PPTX|RA|RAM|SVG|SVGZ|SWF|TAR|TIF|TIFF|TTF|TTC|WAV|WMA|WRI|XLA|XLS|XLSX|XLT|XLW|ZIP)$">
 FileETag MTime Size
 <IfModule mod_headers.c>
 Header set Pragma "public"
 Header append Cache-Control "public"
 Header unset Set-Cookie
 </IfModule>
</FilesMatch>

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_URI} !(robots\.txt|sitemap(_index)?\.xml(\.gz)?|[a-z0-9_\-]+-sitemap([0-9]+)?\.xml(\.gz)?)
 RewriteCond %{REQUEST_FILENAME} \.(css|htc|js|js2|js3|js4|html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ [NC]
 RewriteRule .* - [L]
</IfModule>


# Add correct content-type for fonts
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg

# Compress compressible fonts
AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-opentype image/svg+xml

ExpiresActive on

# Add a far future Expires header for fonts
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType application/x-font-opentype "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"

<IfModule mod_deflate.c>
  <FilesMatch "\.(ico|js|css|html|htm|php|xml|htc)$">
    SetOutputFilter DEFLATE
  </FilesMatch>
</IfModule>

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/xml text/plain text/css text/javascript application/json
</IfModule>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 week"
ExpiresByType image/x-icon "access plus 1 week"
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/jpg "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType text/html "access plus 1 week"
ExpiresByType text/xml "access plus 1 week"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/js "access plus 1 week"
ExpiresByType application/javascript "access plus 1 week"
</IfModule>

# BEGIN Gzip Compression
AddEncoding gzip .gz
<filesmatch "\.js\.gz$">
AddType "text/javascript" .gz
</filesmatch>
<filesmatch "\.css\.gz$">
AddType "text/css" .gz
</filesmatch>
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME} \.(js|css)$
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)$ $1.gz [QSA,L]
</ifmodule>
# END Gzip Compression

Kann mir jemand helfen was ich machen muss, damit die Komprimierung auch für die oben genannten Datein greift? Google habe ich schon ausführliche befragt aber einfach keine Lösung gefunden :/

Das wäre super nett
icon_smile.gif
 
Zuletzt bearbeitet von einem Moderator:
Werbung:
Google habe ich schon ausführliche befragt aber einfach keine Lösung gefunden :/
Les' ich (zu) oft, und am Ende taugte halt blos der Suchbegriff/-term zu nichts.
  1. Hast du dann auch schon all' diese Seiten auf dem Schirm gehabt, die z.T. abweichenden/anderen/weiteren Code zeigen?
  2. Oder https://varvy.com/pagespeed/enable-compression.html
    https://varvy.com/pagespeed/enable-compression.html schrieb:
    How to enable Gzip compression
    • ...
    • Different web servers have different instructions (explained below)
    Here are the most common ways to enable compression including .htaccess, Apache, Nginx, and Litespeed webservers.
    ... um die serverspezifische Gzip-Syntax überprüft/gewählt zu haben?
  3. Und falls der Server dort kein Thema ist, auch Google zur passenden Anleitung befragt?
 
Hallo,
so Lösung wurde gefunden. Leider konnte ich es selber nicht lösen. Und ja - ich hatte sämtliche Seiten durch. Allerdings hatte ich nicht wie vermutet, einen Appache Server.
Es musste die Config Datei geändert werden. Diese befindet sich aber nicht bei mir im Root-Verzeichnis.

Mein Hoster hat es aktiviert :)
 
Werbung:
Status
Für weitere Antworten geschlossen.
Zurück
Oben