SEO

How To Enable GZip Compression WordPress Htaccess?

How To Enable GZip Compression WordPress Htaccess?

In this article, we will discuss how to enable GZip compression WordPress htaccess? Because size compression of any web page before opening to the client’s browser gives a faster site speed. When a user gets high site speed then Search Engine increases the user-experience points regarding your site.

Gzip Compression helps to reduce the file size and it also help to minimize the response time by reducing the HTTP request.

So here in this article, you will able to use Gzip encoding for the HTTP response compression.  Moreover, it will minimize the page downloading response time. This is the best and easy way for reducing the size of a page and gives an effective site’s speed.

Furthermore, the WordPress site’s owner who enable GZip Compression WordPress Htaccess for HTML, JavaScripts and CSS stylesheets can minimize the page size 70-80%. The Gzip Compression helps to reduce the response times which HTTP server call.

Now let’s start to read about it…..

How To Enable GZip Compression WordPress Htaccess?

The server scripting language is Apache and it includes the Mod_Deflate module. But many of us hosts disable this feature from the server. So due to the disabling, it takes too many resources.

By the way, Mod_Deflate mode enabling is the easy way if you have access to the https.conf. Otherwise, you need to consult with your host and ask for enabling this feature.

Moreover, if they enable the Mod_Deflate mode, it will apply to the entire site or a specific directory. It will compress the file or a directory.

Additionally as shown in the below screenshot, you can see the compressed web page via Gzip/ Mod_Deflate minimize the file size to more than 80%.

GZip Comprression Status

Test Before Enable GZip Compression WordPress Htaccess

Check GZip Enabled or Not

http://www.whatsmyip.org/http-compression-test/

If you enable GZip Compression WordPress htaccess then your visitor will get better UE (User Experience).

Enable GZip Compression WordPress Htaccess

When you will place the code in the root directory called .htaccess file then it will tell to compress all coding like HTML, JavaScript or CSS stylesheets.

By the way, if you don’t want to compress the whole site then you need to paste the code in the root directory htaccess file otherwise you will create a .htaccess file in the subdirectory where you want to compress.

Read here: If you don’t have the idea to access .htaccess file then read here: How to access?

# Enable file compression
<IfModule mod_deflate.c>
 <IfModule mod_setenvif.c>
 <IfModule mod_headers.c>
 SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ \
 ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
 RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
 </IfModule>
 </IfModule>
 <IfModule mod_filter.c>
 FilterDeclare COMPRESS
 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/javascript
 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
 FilterChain COMPRESS
 FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no
 </IfModule>
 <IfModule !mod_filter.c>
 AddOutputFilterByType DEFLATE text/css text/html text/plain text/xml
 AddOutputFilterByType DEFLATE text/javascript application/javascript
 </IfModule>
 <IfModule mod_setenvif.c>
 BrowserMatch ^Mozilla/4 gzip-only-text/html
 BrowserMatch ^Mozilla/4\.0[678] no-gzip
 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
 SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
 </IfModule>
 <IfModule mod_headers.c>
 Header append Vary User-Agent env=!dont-vary
 Header append Vary Accept-Encoding
 </IfModule>
</IfModule>

Just copy the above code and paste it to the .htaccess file to enable GZip Compression WordPress Htaccess.

At the end, this was the method to enable GZip Compression WordPress Htaccess. If you like this then don’t forget to share it on the social networking sites. Let’s read the below collection of articles also:

  1. List Of 20+ Quality Blogs Who Are Accepting Guest Posts
  2. Image Optimization Fastly Hacks (Maintain Image Quality)
  3. Top 10 Blogger SEO Tips For Those Who Can’t Understand
Tagged With
Show More

Global Blurb Team

"Global Blurb since 2015" Global Blurb providing information about SEO, Beauty, Health & Fitness, Interior designing, Fashion and ways of earning online without investing a penny. The blog designed to share ideas about different topics.

Want to contribute

Close