[WP GEEKY TIPS #2] Enable gzip compression to speed up your website
What is gzip compression?
It is an efficient method of compressing files and it allows your web server to provide smaller file sizes which load faster for your website users. Enabling it is a standard practice nowadays. If you are not using it, your webpages are likely slower than your competitors.
Compression of HTML and CSS files with gzip typically saves around fifty to seventy percent of the file size. Saving consistently on page load time and bandwidth used.
How to enable gzip compression?
Gzip compression is enabled on a webserver level and each webserver has a different set of instructions. Let's see how can it be achieved on the most common type of webserver available today.
Always consult a developer if you're unsure about what to do.
.htaccess
This method works on Apache webservers. You have to locate (or create) a file called .htaccess in your website root directory and add these lines of code:
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
Save and refresh your page.
Apache
If the above method is not working you have to try in a different way, by adding these lines of code to the .htaccess file instead:
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/javascript
AddOutputFilterByType DEFLATE application/x-javascript
NGINX
On a NGINX webserver you have to add these lines of code to your config file:
gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# Disable for IE < 6 because there are some known problems
gzip_disable "MSIE [1-6].(?!.*SV1)";
# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;
Litespeed
You have to go in the configuration under "tuning", look for "enable compression" and check to see if gzip is on, if not click "edit" then choose to turn it on.
How to check if gzip is enabled on your server?
Use insert the url of your website here.
Congratulations @stegis! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Click on any badge to view your own Board of Honnor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
By upvoting this notification, you can help all Steemit users. Learn how here!
Congratulations @stegis! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Click on any badge to view your own Board of Honnor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
By upvoting this notification, you can help all Steemit users. Learn how here!