Enable Gzip Compression without Plugin
2018·@thinxx·
0.000 HBDEnable Gzip Compression without Plugin
<center>https://dxxd.bid/wp-content/uploads/2019/01/16117457539_65a94fd645_c.jpg</center> <br/>Hi Guys I thought I'd take a minute to explain just exactly how to enable Gzip compression on an Apache server without a plugin. <h3>What is GZIP Compression?</h3> <a href="https://en.wikipedia.org/wiki/Gzip" target="_blank" rel="noopener">GZIP</a> is a type of file format as well as a software application used for file compression and decompression. It is enabled server-side, and allows for further reduction in the size of your HTML, stylesheets, and JavaScript files. GZip will <strong>NOT</strong> work on images as these are already compressed in a different way. Some people have seen up to 70% reductions due to compressing their sites and It's also probably one of the easiest optimizations you could make when it comes to WordPress. <img src="https://dxxd.bid/wp-content/uploads/2019/01/apache-cpanel-example-1024x583.jpg" sizes="(max-width: 1024px) 100vw, 1024px" srcset="https://i0.wp.com/dxxd.bid/wp-content/uploads/2019/01/apache-cpanel-example.jpg?w=1024&ssl=1 1024w, https://i0.wp.com/dxxd.bid/wp-content/uploads/2019/01/apache-cpanel-example.jpg?resize=300%2C171&ssl=1 300w, https://i0.wp.com/dxxd.bid/wp-content/uploads/2019/01/apache-cpanel-example.jpg?resize=768%2C437&ssl=1 768w, https://i0.wp.com/dxxd.bid/wp-content/uploads/2019/01/apache-cpanel-example.jpg?resize=350%2C199&ssl=1 350w" alt="" width="1024" height="583" /><br/> When a web browser like Chrome or Firefox fetches a website it first checks to see if the web server has GZIP enabled. It does this by checking if the “content-encoding: gzip” response header exists and if the header is detected, it serves up the compressed and smaller files. If not, the browser will serve the uncompressed files instead. Not having GZIP enabled, will most likely cause you to see warnings and errors in speed testing tools such as Google PageSpeed Insights and <a href="https://gtmetrix.com" target="_blank" rel="noopener">GTmetrix</a>. Chances are, that if a speed-test states that Gzip compression is not enabled... well, it probably isn't... or, it just hasn't been implemented correctly... so let's fix that. <h2>Enable GZIP on Apache:</h2> <img src="https://dxxd.bid/wp-content/uploads/2019/01/htaccess-location.jpeg" sizes="(max-width: 365px) 100vw, 365px" srcset="https://i1.wp.com/dxxd.bid/wp-content/uploads/2019/01/htaccess-location.jpeg?w=365&ssl=1 365w, https://i1.wp.com/dxxd.bid/wp-content/uploads/2019/01/htaccess-location.jpeg?resize=300%2C113&ssl=1 300w, https://i1.wp.com/dxxd.bid/wp-content/uploads/2019/01/htaccess-location.jpeg?resize=350%2C132&ssl=1 350w" alt="" width="365" height="138" /><br/> Although there are plugin's that can do this... I solely recommend enabling Gzip compression by editing your .htaccess file. Most shared hosts use the Apache server management system, in which you can simply add the code below to your .htaccess file. You can find your .htaccess file at the root of your WordPress site via your File Manager(usually "/public"). NB: Ensure <a href="https://httpd.apache.org/docs/2.4/mod/mod_filter.html" target="_blank" rel="noopener">mod_filter</a> is loaded on your server, otherwise the AddOutputFilterByType directive will not work and could cause a <a href="https://www.westhost.com/knowledgebase/display/WES/What+Is+A+500+error" target="_blank" rel="noopener">500 error</a>. We strongly recommend checking your error logs inside Wordpress to see if you have any issues with the code below. <blockquote> <h5># Compress HTML, CSS, JavaScript, Text, XML and fonts AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/vnd.ms-fontobject AddOutputFilterByType DEFLATE application/x-font AddOutputFilterByType DEFLATE application/x-font-opentype AddOutputFilterByType DEFLATE application/x-font-otf AddOutputFilterByType DEFLATE application/x-font-truetype AddOutputFilterByType DEFLATE application/x-font-ttf AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE font/opentype AddOutputFilterByType DEFLATE font/otf AddOutputFilterByType DEFLATE font/ttf AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE image/x-icon AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/xml</h5> <h5># Remove browser bugs (only needed for really old browsers) BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4.0[678] no-gzip BrowserMatch bMSIE !no-gzip !gzip-only-text/html Header append Vary User-Agent</h5> </blockquote> <h4>Now here's the trick...</h4> <img src="https://dxxd.bid/wp-content/uploads/2019/01/htaccess-example.jpeg" alt="" width="259" height="194" /><br/> Finally, you need to ensure that you add the code <strong>below the current contents of your .htaccess file</strong>. So, after the line that say's <strong># END WORDPRESS</strong> And that's it!! Hopefully I gave you some insight into speeding up your site and I will try to do more of these as I am able to... Please let me know if you have any questions and I'll try my best to assist. If you'd like to have a site built, please get in touch and lets give your brand the look it deserves. You can also have a look at our <a href="https://dxxd.bid/portfolio/">Portfolio</a> page for more website & design examples. Have an awesome day everyone! <strong>~dxxd </strong><a href="mailto:admin@dxxd.bid">admin@dxxd.bid</a> <img src="https://dxxd.bid/wp-content/uploads/2019/01/dxxd-text-logo-2018-copy-350x162.jpg" sizes="(max-width: 350px) 100vw, 350px" srcset="https://i0.wp.com/dxxd.bid/wp-content/uploads/2019/01/dxxd-text-logo-2018-copy.jpg?resize=350%2C162&ssl=1 350w, https://i0.wp.com/dxxd.bid/wp-content/uploads/2019/01/dxxd-text-logo-2018-copy.jpg?resize=300%2C139&ssl=1 300w, https://i0.wp.com/dxxd.bid/wp-content/uploads/2019/01/dxxd-text-logo-2018-copy.jpg?resize=768%2C355&ssl=1 768w, https://i0.wp.com/dxxd.bid/wp-content/uploads/2019/01/dxxd-text-logo-2018-copy.jpg?w=1024&ssl=1 1024w" alt="" width="350" height="162" /><br/> <br /><center><hr/><em>Posted from my blog with <a href='https://wordpress.org/plugins/steempress/'>SteemPress</a> : https://dxxd.bid/enable-gzip-compression-without-plugin/ </em><hr/></center>
👍 thinxx,