Enable Gzip Compression Using the .htaccess File

This tutorial will show you how to modify the .htaccess file using the File Manager of your control panel. We’ll be using Hostnil’s cPanel.

To enable compression via the .htaccess file, follow the steps below:

  1. Log in to cPanel and click on File Manager. 
  2. Click on the public_html folder.
  3. Find the .htaccess file. Download the file and save a copy on your computer as a backup. Then, double-click on the .htaccess file located in the public_html folder to open it.
  4. Paste the following code into it before the END WordPress line.
<IfModule mod_deflate.c>
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
</IfModule>
  1. Once finished, click the Save button.
Was this answer helpful? 0 Users Found This Useful

Related Articles

Wordpress Website Speed Optimization

If you realised your Wordpress website is slow, you can try the following optimization practices:...