How to Add Gzip Compression To Your Website
This week were showing you guys the number 1 way to speed up your WordPress website! This video shows you how to add what is known as Gzip compression code to your website to compress your website files up to 70%! Adding this code to your website will massively increase speed while also making pages smaller so the browsers can load them lightning quick.
By adding this code your telling the browser take these file types and shrink them before rendering them to people visiting the website so instead of getting the full 3 or 4mb pages they will get 1.2 or 1.4mb pages allowing the page to load within seconds from page to page. This helps not only with speed and usability of the site but also with SEO as well, as this will allow search engines to crawl the site faster and show the search engines that your site is loading within the reasonable time limits set by the algorithms.
This code will work for all code in the site and all future images added as well! It’s not like a compression program that you have to use every time you upload new content as it is in the htaccess file which controls the entire site rather than a plugin which works when you use it or when it’s set to run. This code is set to compress the main site and all files rather than per person or per visit meaning the entire site and all files are compressed.
With this code implemented you should see a 1.5 to 2 second increase in speed depending on the size of your website!
To implement this code grab the full text below and watch the video above to see how you can put it in your site depending on weather or not you have the plugins mentioned in the video. We show you both ways with certain plugins that allow you to access the files and directly through ftp by accessing the htaccess file and editing it directly.
The main Gzip code only compresses png so we have slightly changed the one below to also compress .jpg and .jpeg as these are a much more common file type used by most websites. By also adding these file types your jpegs will be compressed as well not just png file formats.
#Begin GZip Compression
# Insert filters
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE image/svg+xml
AddType x-font/otf .otf
AddType x-font/ttf .ttf
AddType x-font/eot .eot
AddType x-font/woff .woff
AddType image/x-icon .ico
AddType image/png .png
AddType image/jpg .jpg
AddType image/jpeg .jpeg
#End Gzip Compression