Home web designing cPanel Enable Gzip Compression Using .Htaccess To SpeedUp Website

Enable Gzip Compression Using .Htaccess To SpeedUp Website


Enable Gzip

Gzip compression is very helpful to boost the speed of a website. By enabling developer can reduce the server load . In this article you will learn how to enable Gzip compression using the following in .htaccess .


  1. Tips to Boost Website Speed
  2. How To Reduce Website Loading Time Using Page Speed Insights
  3. Easy Way To Compress HTML Delivery

The .htaccess file controls many important things for your site.

cpanel image

Steps to Enable Gzip Compression

Login to your Cpanel and then locate the File Manager. Under the File Manager folder locate the file .htaccess . If this file not exist in it ,then you have to create the it . Learn how to create how to create and edit .htaccess file.


htaccess file
htaccess file

.htaccess looks like as the upper image. If it is already existed in the folder ,then open it and write the following code in it.

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

Save the .htaccess file and then refresh your webpage. Now Gzip compression is enabled on your webhost . Check to see if your compression is working using the Gzip compression tool.