Op je website heb je de optie om Gzip/G-zip te gebruiken. Gzip is een vorm van compressie, wat betekent dat als je dit gebruikt op je website, de omvang kleiner wordt. Het gevolg is dat je website sneller laadt en je dus meer verkeer kunt verwerken en de gebruikerservaring als geheel aangenamer wordt.
Je schakelt Gzip-compressie in op je website door onderstaande stappen te doorlopen.
Gzip activeren op een webhostingpakket
Ga binnen je controlepaneel via het linkermenu naar 'Webhosting'. Klik vervolgens onder 'Producten' op je domeinnaam.
Klik vervolgens bovenaan op 'Geavanceerd' en daarna op 'Prestaties en Caching'.
Je schakelt Gzip in door naast 'Gzip compression' op de schuifknop te klikken. Gzip is geactiveerd zodra de knop groen is zoals te zien in de bovenstaande afbeelding.
Gzip activeren op een VPS
Open de .htaccess en (wp-)config.php bestanden met een tekst-editor (e.g. notepad, Notepad++,) en voeg het volgende toe bovenaan in je .htaccess-bestand:
<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 filter_module> 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} = 'application/x-font-ttf'" FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'font/opentype'" FilterChain COMPRESS FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no </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 AddOutputFilterByType DEFLATE application/atom+xml AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject AddOutputFilterByType DEFLATE application/x-font-ttf font/opentype </IfModule> </IfModule> <IfModule !mod_deflate.c> #Apache deflate module is not defined, active the page compression through PHP ob_gzhandler php_flag output_buffering On php_value output_handler ob_gzhandler </IfModule>
en het volgende direct na <?php in (wp-)config.php (i.e. bovenaan in het bestand):
ob_start('ob_gzhandler');
Je wp-config.php bestand zou dan dus in het begin er uit moeten zien als volgt:
<?php ob_start('ob_gzhandler'); /** * The base configurations of the WordPress. * * This file has the following configurations: MySQL settings, Table Prefix, * Secret Keys, and ABSPATH. You can find more information by visiting * {@link http://codex.wordpress.org/Editing_wp-config.php Editing wp-config.php} * Codex page. You can get the MySQL settings from your web host.
Sla de bestanden op en upload ze terug naar je website om Gzip te activeren.
Mocht je aan de hand van dit artikel nog vragen hebben, aarzel dan niet om onze supportafdeling te benaderen. Je kunt ons bereiken via de knop 'Neem contact op' onderaan deze pagina.