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?
- Log into cPanel
- On the dashboard, click on File manager.
- Go to the public_html folder.
- By default, .htaccess is hidden. So click the Settings button and check the Show hidden files (dotfiles) mark.
- Now click on .htaccess and click Edit.
- Add at the end of the file:
- 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.