Activer la compression GZIP ?

Nouveau WRInaute
Bonjour à tous et pardonnez d'avance mon manque de compréhension à ce sujet, mais je ne sais pas déterminer si la compression GZIP est activée ou non sur mon site, sinon comment je pourrais le faire, qu'est-ce que ça m'apporterait concrètement et est-ce que le fait que j'aie un hébergement à 3€/mois chez 1&1 m'empêche d'activer la compression GZIP (et si oui, quel hébergement prendre, de préférence toujours chez 1&1).

C'est Google Page Speed Insights qui me dit qu'il faut activer la compression GZIP. S'il le dit, c'est qu'il doit avoir raison, donc je le crois :mrgreen:

Voilà mon site au fait : http://radinmalinblog.com

Sinon, j'ai aussi activé le CDN de 1&1, 'paraît que ça accélère le chargement aussi, qu'en pensez-vous ?

Merci à vous !
 
Nouveau WRInaute
Merci Drew ! Voilà ce que me dit ton site :


Web page compressed? Yes
Compression type? gzip
Size, Markup (bytes) 525,513
Size, Compressed (bytes) 49,277
Compression % 90.6


Donc apparemment GZIP est bel est bien activé, pourtant Google Pagespeed Insights me dit qu'il faudrait activer GZIP. Du coup, j'imagine que c'est mon hébergement qui est pourri, non ?
 
Nouveau WRInaute
Ok, tes 2 sites me disent qu'il faut activer GZip donc je vais le faire (même si j'avais déjà installé des plugins et modifié .htacess via des tutos, visiblement ça n'a pas marché...)

Ils me disent aussi "Éliminer les codes JavaScript et CSS qui bloquent l'affichage du contenu au-dessus de la ligne de flottaison" <= ce que je ne comprends pas non plus, même en suivant les tutos...

Par contre, je ne comprends pas : où faut-il que je colle le code que tu m'as fourni dans le .htaccess exactement ? N'importe où, c'est bon ?

Merci :)
 
WRInaute passionné
Slt,
Code:
# ----------------------------------------------------------------------
# Gzip compression
# ----------------------------------------------------------------------

<IfModule mod_deflate.c>

  # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
  <IfModule mod_setenvif.c>
    <IfModule mod_headers.c>
      SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
      RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
    </IfModule>
  </IfModule>

# HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
  <IfModule version.c>
  <IfModule filter_module.c>
    <IfVersion >= 2.4>
      FilterDeclare   COMPRESS
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'text/html'"
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'text/css'"
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'text/plain'"
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'text/xml'"
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'text/x-component'"
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'application/javascript'"
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'application/json'"
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'application/xml'"
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'application/xhtml+xml'"
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'application/rss+xml'"
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'application/atom+xml'"
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'application/vnd.ms-fontobject'"
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'image/svg+xml'"
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'image/x-icon'"
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'application/x-font-ttf'"
      FilterProvider  COMPRESS  DEFLATE "%{CONTENT_TYPE} = 'font/opentype'"
      FilterChain     COMPRESS
      FilterProtocol  COMPRESS  DEFLATE change=yes;byteranges=no
    </IfVersion>
    <IfVersion <= 2.2>
      FilterDeclare   COMPRESS
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/html
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/css
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/plain
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/xml
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/x-component
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/javascript
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/json
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xml
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xhtml+xml
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/rss+xml
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/atom+xml
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/vnd.ms-fontobject
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $image/svg+xml
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $image/x-icon
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/x-font-ttf
      FilterProvider  COMPRESS  DEFLATE resp=Content-Type $font/opentype
      FilterChain     COMPRESS
      FilterProtocol  COMPRESS  DEFLATE change=yes;byteranges=no
    </IfVersion>
  </IfModule>
  </IfModule>

  <IfModule !mod_filter.c>
    # Legacy versions of Apache
    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>
 
Nouveau WRInaute
Drew : j'ai mis ton code en entier à la place de l'original dans mon .htaccess et5 minutes après, mon site ne marchait plus (internal server error 500)
 
Nouveau WRInaute
J'ai viré mon .htacess et je l'ai remplacé par un nouveau avec juste ce texte dedans (et c'est là que j'ai eu l'erreur) :

Drew a dit:
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteRule index.html / [R=301,L]

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/atom+xml application/rss+xml application/xml application/javascript

<IfModule mod_headers.c>
<FilesMatch ".(ico|jpe?g|png|gif|swf|flv|css|js|gz|pdf)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
<filesMatch ".(html|htm|xml)$">
Header set Cache-Control "max-age=43200"
</filesMatch>
<FilesMatch ".(php|cgi)$">
Header unset Cache-Control
</FilesMatch>
</IfModule>

<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 7200 seconds"
AddType image/x-icon .ico
AddType application/x-font-woff .woff
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType image/ico "access plus 2592000 seconds"
ExpiresByType image/jpg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/icon "access plus 2592000 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType text/css "access plus 2592000 seconds"
ExpiresByType text/html "access plus 7200 seconds"
ExpiresByType text/javascript "access plus 2592000 seconds"
ExpiresByType application/xhtml+xml "access plus 7200 seconds"
ExpiresByType application/x-javascript "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
ExpiresByType application/x-font-woff "access plus 2592000 seconds"
</IfModule>

Header unset ETag
FileETag none

<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
Header always append X-Frame-Options SAMEORIGIN
Header set X-Content-Type-Options: "nosniff"
</IfModule>

Options -Indexes
ServerSignature off

ErrorDocument 403 http://***-*******.***/403.php
ErrorDocument 404 http://***-*******.***/404.php
 
Nouveau WRInaute
Excuse-moi, je dois être un peu débile :mrgreen: mais ça n'a pas marché : j'ai mis uniquement le code que tu m'as donné au-dessus dans un fichier vierge que j'ai renommé .htaccess, et 1h après, mon blog me faisait des erreurs 403 partout

Mais au pire c'est pas grave t'en fais pas pour moi c'est déjà gentil de ta part de m'avoir répondu
 
Discussions similaires
Haut