How to Enable GZIP Compression

In this post, We going to see how to enable GZIP compression using a .htaccess file. To perform quick load time on your website first you need to reduce the size of your webpage. By enabling GZIP compression will help to reduce the size of your webpage, this can increase the webpage speed and reduce the amount of time to download the file request.
How to Enable GZIP Compression
Here we have few options to enable the GZIP compression, below in this we can see how to do that.
Using WordPress Plugin Enable GZIP
By using WordPress plugins we can enable GZIP compression easily. Using some of the WordPress plugins are add the code automatically in .htacces. Even though these are WordPress plugins, this still relies on permissions to change files on your web server. If your caching plugin doesn’t have support, you will need to contact your hosting provider.
Here you have few plugins to enable GZIP.
1. WP Fastest Cache
2. Hummingbird
3. W3 Total Cache
Using Apache Enable GZIP
By using the .htaccess file you can enable GZIP compression. Most of the shared hosting use Apache Server in that you have .htaccess file using that you can edit and add the following below code in your .htaccess. You can find the .htaccess file in your root folder. If you can’t able to see the file here you have an article.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<IfModule mod_deflate.c> # 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 # 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 </IfModule> |
Check whether the GZIP compression is working fine or not using the GZIP compression tool.
Note: If you get 500 Internal Server Error you need to check your server error log to solve this issue.
.htaccessawscloud serverserverwordpress
Mraj
Creative Designer & Developer specialist by the spirit and a loving blogger by thoughts. If you have any questions let me drop an email with the article name to the following email id: [email protected]