{"id":2898,"date":"2019-02-22T11:54:48","date_gmt":"2019-02-22T10:54:48","guid":{"rendered":"https:\/\/www.ybierling.com\/v2\/?p=2898"},"modified":"2019-02-04T17:56:06","modified_gmt":"2019-02-04T16:56:06","slug":"how-to-enable-gzip-compression-wordpress","status":"publish","type":"post","link":"https:\/\/www.ybierling.com\/v2\/en\/how-to-enable-gzip-compression-wordpress\/","title":{"rendered":"How to enable GZIP compression WordPress"},"content":{"rendered":"<h2 id=\"enable-gzip-compression-in-wordpress\">Enable gzip compression in WordPress<\/h2>\n<p>In order to render your web pages faster from WordPress, and to score higher on Google PageSpeed Insights, especially on the Enable Compression test, you should activate Gzip compression. You can check if that&#8217;s the case for your website on gidnetwork.<\/p>\n<p><span id=\"ezoic-pub-ad-placeholder-600\" class=\"ezoic-adpicker-ad\"><\/span> <a class=\"noclass\" title=\"WordPress GZIP compression test\" href=\"http:\/\/www.gidnetwork.com\/tools\/gzip-test.php\" target=\"_blank\" rel=\"noopener nofollow\"> WordPress GZIP compression test <\/a><\/p>\n<p><span id=\"ezoic-pub-ad-placeholder-175\" class=\"ezoic-adpicker-ad\"><\/span>Quick hint : best solution is to activate gzip compression for WordPress with PHP by adding this code at the beggining of your wp-config.php file:<span id=\"ezoic-pub-ad-placeholder-176\" class=\"ezoic-adpicker-ad\"><\/span><\/p>\n<pre class=\"box_info\"><code><em>ini_set(\"zlib.output_compression\", \"On\");\n ini_set(\"zlib.output_compression_level\", \"-1\");<\/em><\/code><\/pre>\n<div id=\"google_ads_iframe_\/1254144\/ybierling_com-large-leaderboard-2_0__container__\"><iframe id=\"google_ads_iframe_\/1254144\/ybierling_com-large-leaderboard-2_0\" title=\"3rd party ad content\" name=\"google_ads_iframe_\/1254144\/ybierling_com-large-leaderboard-2_0\" width=\"250\" height=\"250\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" data-google-container-id=\"b\" data-mce-fragment=\"1\"><\/iframe><\/div>\n<p><span id=\"div-gpt-ad-ybierling_com-large-leaderboard-2-0\" class=\"ezoic-ad ezfound\" data-google-query-id=\"CK6l2ua_ouACFYZ00wod_3UNjQ\"><\/span><span id=\"ezoic-pub-ad-placeholder-187\" class=\"ezoic-adpicker-ad\"><\/span><a title=\"Activate gzip compression for WordPress with PHP\" href=\"https:\/\/www.ybierling.com\/en\/blog-web-checkgzipcompression\" target=\"_blank\" rel=\"noopener\"> Activate gzip compression for WordPress with PHP <\/a><\/p>\n<div>\n<figure class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"b-lazy b-loaded\" src=\"https:\/\/www.ybierling.com\/images\/medium\/web\/gzipcompressionwordpress\/gzipcompressionwordpress1.png\" alt=\"How to enable GZIP compression WordPress : Add code in the wp.config.php file\" width=\"240\" height=\"158\" \/><figcaption class=\"wp-caption-text\">How to enable GZIP compression WordPress : Add code in the wp.config.php file<\/figcaption><\/figure>\n<\/div>\n<h2 id=\"best-wordpress-compression-plugin\"><span id=\"ezoic-pub-ad-placeholder-158\" class=\"ezoic-adpicker-ad\"><\/span>Best WordPress compression plugin<span id=\"ezoic-pub-ad-placeholder-174\" class=\"ezoic-adpicker-ad\"><\/span><\/h2>\n<p>Many plugins promise to make it happen : Gzip ninja speed compression, W3 Total cache, but sometimes it just doesn&#8217;t work.<\/p>\n<p><a class=\"noclass\" title=\"Gzip ninja speed compression WordPress plugin\" href=\"https:\/\/wordpress.org\/plugins\/gzip-ninja-speed-compression\/\" target=\"_blank\" rel=\"noopener nofollow\"> Gzip ninja speed compression WordPress plugin <\/a><br \/>\n<a class=\"noclass\" title=\"W3 Total Cache WordPress plugin\" href=\"https:\/\/wordpress.org\/plugins\/w3-total-cache\/\" target=\"_blank\" rel=\"noopener nofollow\"> W3 Total Cache WordPress plugin <\/a><\/p>\n<p>After trying these plugins, this is the result we got &#8211; gzip compression wasn&#8217;t working, either with plugins or with htaccess update.<\/p>\n<div>\n<figure class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"b-lazy b-loaded\" src=\"https:\/\/www.ybierling.com\/images\/medium\/web\/gzipcompressionwordpress\/gzipcompressionwordpress2.png\" alt=\"How to enable GZIP compression WordPress : Compression not activated, checked on gidnetwork\" width=\"240\" height=\"137\" \/><figcaption class=\"wp-caption-text\">How to enable GZIP compression WordPress : Compression not activated, checked on gidnetwork<\/figcaption><\/figure>\n<\/div>\n<p>The score on Google PageSpeed Insights for our website were pretty bad:<\/p>\n<div>\n<figure class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"b-lazy b-loaded\" src=\"https:\/\/www.ybierling.com\/images\/medium\/web\/gzipcompressionwordpress\/gzipcompressionwordpress3.png\" alt=\"How to enable GZIP compression WordPress : Bad score on Google PageSpeed Insights due to activate compression\" width=\"240\" height=\"138\" \/><figcaption class=\"wp-caption-text\">How to enable GZIP compression WordPress : Bad score on Google PageSpeed Insights due to activate compression<\/figcaption><\/figure>\n<\/div>\n<p>Therefore, the best solutions are to update your htaccess, or, if still not working, to add the code mentioned above, to get following results &#8211; unfortunately, external scripts can only be improved by their owners.<\/p>\n<div id=\"google_ads_iframe_\/1254144\/ybierling_com-medrectangle-4_0__container__\"><iframe id=\"google_ads_iframe_\/1254144\/ybierling_com-medrectangle-4_0\" title=\"3rd party ad content\" src=\"https:\/\/tpc.googlesyndication.com\/safeframe\/1-0-31\/html\/container.html\" name=\"\" width=\"250\" height=\"250\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" data-is-safeframe=\"true\" data-google-container-id=\"c\" data-load-complete=\"true\" data-mce-fragment=\"1\"><\/iframe><\/div>\n<h2 id=\"enable-gzip-compression-wordpress-htaccess\"><span id=\"div-gpt-ad-ybierling_com-medrectangle-4-0\" class=\"ezoic-ad ezfound\" data-google-query-id=\"CIns6-a_ouACFYqtUQodYFEA2w\"><\/span>Enable GZIP compression WordPress htaccess<span id=\"ezoic-pub-ad-placeholder-160\" class=\"ezoic-adpicker-ad\"><\/span><\/h2>\n<p>Another solution is to enable GZIP compression in WordPress htaccess. To do so, simply open the htaccess file with a text editor, and add these lines somewhere in a new line in the file, and upload it back on the webserver with these changes included to enable GZIP compression WordPress:<\/p>\n<div id=\"google_ads_iframe_\/1254144\/ybierling_com-medrectangle-3_0__container__\"><iframe id=\"google_ads_iframe_\/1254144\/ybierling_com-medrectangle-3_0\" title=\"3rd party ad content\" src=\"https:\/\/tpc.googlesyndication.com\/safeframe\/1-0-31\/html\/container.html\" name=\"\" width=\"728\" height=\"90\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" data-is-safeframe=\"true\" data-google-container-id=\"i\" data-load-complete=\"true\" data-mce-fragment=\"1\"><\/iframe><\/div>\n<pre class=\"box_info\"><code><em>#Compression\n \n AddOutputFilterByType DEFLATE text\/text text\/html text\/plain text\/xml text\/css text\/javascript application\/javascript\n <\/em><\/code><\/pre>\n<p>If your server allows compression and the mod_deflate is installed, then the GZIP compression for your WordPress site will be activated.<\/p>\n<div>\n<figure class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"b-lazy b-loaded\" src=\"https:\/\/www.ybierling.com\/images\/medium\/web\/gzipcompressionwordpress\/gzipcompressionwordpress4.png\" alt=\"How to enable GZIP compression WordPress : Compression activated as checked on gidnetwork\" width=\"240\" height=\"135\" \/><figcaption class=\"wp-caption-text\">How to enable GZIP compression WordPress : Compression activated as checked on gidnetwork<\/figcaption><\/figure>\n<\/div>\n<div>\n<figure class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"b-lazy b-loaded\" src=\"https:\/\/www.ybierling.com\/images\/medium\/web\/gzipcompressionwordpress\/gzipcompressionwordpress5.png\" alt=\"How to enable GZIP compression WordPress : Google PageSpeed insights results improved after activated gzip compression in WordPress\" width=\"240\" height=\"156\" \/><figcaption class=\"wp-caption-text\">How to enable GZIP compression WordPress : Google PageSpeed insights results improved after activated gzip compression in WordPress<\/figcaption><\/figure>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Enable gzip compression in WordPress In order to render your web pages faster from WordPress, and to score higher on<\/p>\n","protected":false},"author":1,"featured_media":2899,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[576],"tags":[10937,10919,10945,10927,10923,10929,10917,10915,10931,10913,10939,10933,10921,10943,10935,10925,10941],"class_list":["post-2898","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web","tag-best-wordpress-compression-plugin","tag-compress-components-with-gzip-wordpress","tag-compress-wordpress-site","tag-enable-compression-wordpress","tag-enable-compression-wordpress-htaccess","tag-enable-gzip-compression-in-wordpress","tag-enable-gzip-compression-wordpress","tag-enable-gzip-compression-wordpress-htaccess","tag-gzip-compression-for-wordpress","tag-gzip-compression-wordpress","tag-how-to-enable-compression-in-wordpress","tag-how-to-enable-compression-wordpress","tag-how-to-enable-gzip-compression-wordpress","tag-wordpress-compress-html","tag-wordpress-compression","tag-wordpress-image-compression","tag-wordpress-video-compression-plugin"],"_links":{"self":[{"href":"https:\/\/www.ybierling.com\/v2\/wp-json\/wp\/v2\/posts\/2898","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ybierling.com\/v2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ybierling.com\/v2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ybierling.com\/v2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ybierling.com\/v2\/wp-json\/wp\/v2\/comments?post=2898"}],"version-history":[{"count":2,"href":"https:\/\/www.ybierling.com\/v2\/wp-json\/wp\/v2\/posts\/2898\/revisions"}],"predecessor-version":[{"id":2901,"href":"https:\/\/www.ybierling.com\/v2\/wp-json\/wp\/v2\/posts\/2898\/revisions\/2901"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ybierling.com\/v2\/wp-json\/wp\/v2\/media\/2899"}],"wp:attachment":[{"href":"https:\/\/www.ybierling.com\/v2\/wp-json\/wp\/v2\/media?parent=2898"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ybierling.com\/v2\/wp-json\/wp\/v2\/categories?post=2898"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ybierling.com\/v2\/wp-json\/wp\/v2\/tags?post=2898"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}