g zip IfModule .htaccess

enable gzip compression through htaccess?

How G-zip works

if you add the code of gzip by creating .htaccess file and adding it, then this gzip code compresses the html, js, text code of your website, so that your 1 MB file becomes 1 kb. Becomes faster so that it does not take much time to open the website

One option is to enable gzip compression through the . htaccess file. Gzip compressions reduce file size that in-turn increases website speed

Gzip is a method that makes files smaller in size, that is, it simply compresses the files. But does compressing files helps in increasing website speed? Yes. Let’s see how it is possible.

When a visitor makes a request to access a website, the server sends the corresponding file. If the file is larger, say 2MB, it takes around 5 seconds to reach the visitor’s browser.

At the same time, if the server compresses this 2MB file to 50KB using a compression method like gzip, it reaches its destination within milliseconds.

How we enable gzip compression through htaccess?

if you add the code of gzip by creating .htaccess file and adding it, then this gzip code compresses the Compress HTML, CSS, JavaScript, Text, XML and fonts code of your website, so that your 2 MB file becomes 50 kb. Becomes faster so that it does not take much time to open the website

g zip IfModule .htaccess

To enable Gzip compression through .htaccess, you can add the following code to your .htaccess file:

<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>

 

This code tells the server to compress all specified file types before sending them to the browser. This can greatly reduce the amount of data that needs to be transferred, which can lead to faster page load times.

As for SEO, Gzip compression is not directly related to SEO, but it can help improve the user experience, which can indirectly affect your site’s search engine rankings.

Additionally, you can also follow other SEO techniques like providing quality content, creating a user-friendly site structure, optimizing your images, building backlinks, and creating a responsive web design to boost your website’s ranking on search engines.

G-zip compression code .htaccess


<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 mime ^application/x-javascript.*
mod_gzip_item_include mime ^text/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_include handler ^cgi-script$
</ifModule>

Enables gzip-compression will speed up your WordPress website drastically and reduces bandwidth usage as well. If you have developed your website in wordpress CMS and looking for enable gzip compression, then you two option to do this,

How to check my website gzip enable or not ?

Do you want to check whether gzip is enabled on your website or not, then you have added your gzip code on the website, you want to check whether the gzip code is running now or not, then you can find out from the steps given below. can

Step 1:- First of all you have to click on this link https://webtool.codinghelp.in/Check-Gzip-or-Brotli-Compression.php

Step 2:- paste your website url click on test button you will get to see the status of gzip

As you will be getting to see in the top that Gzip Is Enabled, then you can also find out like this.

If you have this enabled then your website will start opening fast.

What is Gzip Compression?
The two most common compression algorithms are Gzip and Brotli. Gzip is the oldest and most common of the two. It was written by Jean-loup Gailly and Mark Adler. The initial beta release was made in 1992. The first actual version, version 1.0, was released in early 1993. back in 1992 just as the web was coming online for most people.

Gzip was designed as an all-purpose compression library. The theories behind Gzip were based on the earlier compression algorithm, DEFLATE.

Because of its popularity – and the fact that it is very good at making files small – it is still widely used today both in different operating systems as well as a primary compression algorithm for web servers.

What is Brotli Compression?
Brotli was developed by Google employees Jyrki Alakuijala and Zoltán Szabadka in 2013. Google was originally looking for a better way to compress WOT files which are web fonts.

Gzip was originally intended to compress files and has been adapted to compressing streams so it could work on the web. Brotli on the other hand, was designed from the beginning to compress streams. This makes it a better choice for web servers to compress content before streaming it to a browser.

In 2015, Google released the Brotli specification for HTTP. In addition to specifying how the browser should notify the server that it can decompress Brotli by sending a “Content-Encoding: br” header, Google engineers also made other improvements to Brotli that made it even faster for compressing web content.

Leave a Reply

Your email address will not be published. Required fields are marked *