This manual is only for those, who runs pure Apache. In Apache + Nginx, gzip is activated by default.

.htaccess — Apache web-server configuration file. It controls many parameters of directories without interfering with overall server configuration. With .htaccess you can set access privileges, create error pages, control file and folder compression etc.

How to enable gzip compression?

  1. Log into cPanel
  2. On the dashboard, click on File manager.
  3. Go to the public_html folder.3
  4. By default, .htaccess is hidden. So click the Settings button and check the Show hidden files (dotfiles) mark.
  5. Now click on .htaccess and click Edit3d38405022
  6. Add at the end of the file:
    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
  7. After you are done with the file, click on Save changes.

Once you are done — turn on mod_deflate module in Apache. If you are running a website on a hosting, ask your support to do it for you. On Unihost hosting, it is enabled by default.