|How-to||– 9 min read –||September 10, 2019|
How to enable Gzip-compression of pages on a site
What is Gzip page compression
If you compress the contents, the server will need less time to process them. It submits files in a compressed form, and the browser unpacks them and displays them in full size on the screen.
Search engines better index sites that use data compression. The transfer of information in this format means faster loading of pages, as a result of which the user does not have to wait long. As a result, submitting files in a compressed form positively affects the ranking of search engines and the loyalty of site visitors.
How to check gzip-compression of the site
To achieve maximum efficiency, one compression will not be enough. It must be used in conjunction with other methods to reduce the weight of pages:
- use .gif, .jpeg, .png image formats depending on their type;
- apply caching technology;
- reduce the size of .css and .js files;
- Include .css files at the top of the page, and .js at the end;
- reduce the number of HTTP requests.
All these steps together will reduce the weight of the page, increase the speed of their loading, and have a positive impact on the ranking.
How to enable Gzip compression on Apache
The minus is the additional load on the server. Hosting resources may not pull sites with high traffic. You will have to switch to a more expensive tariff or change the provider.
To enable compression in Apache, you need to add a code element to the .htaccess file. Access to it is available in the hosting admin panel or any FTP client:
If it is impossible to resolve the issue through mod_deflate, try using another mod_gzip module instead. To do this, enter the commands in the .htaccess file:
Static compression differs from dynamic compression in the absence of server load. You independently compress each file and upload it to the root folder of the site. After that, the server will transmit data to the browser immediately in a compressed form. This step eliminates the need to switch to a more expensive hosting tariff. But after updating the files, you will have to manually create compressed copies of each new document.
To enable static compression, download all the files of the required formats to your computer using the file manager or hosting panel. Next, install the program 7-Zip. Find through the program each file that you want to compress. Right-click on each of them and add it to the archive:
How to enable Gzip compression on Nginx and other servers
If the site is located on Beget, IspManager and you were unable to enable compression by adding a code snippet to .htaccess, contact the hosting support service with a request to enable compression on the server.
How to increase website loading speed on WordPress
In the first case, it is necessary to manually create Gzip archives of each file, thereby reducing the load on the server. In the second option, just plug the module into the .htaccess file and check the Gzip compression of the HTML pages again. If such changes did not work, contact the support service of your hosting provider for help.
Learn how to get the most out of Serpstat
Want to get a personal demo, trial period or bunch of successful use cases?
Send a request and our expert will contact you ;)
Cases, lifehacks, researches and useful articles
Don’t you have time to follow the news? No worries!
Our editor Stacy will choose articles that will definitely help you with your work. Join our cozy community :)