Enable Gzip compression is a good solution for site optimization, as search engines rank pages with compressed text better. In addition, fast-loading pages are more convenient for users. To compress pages, activate one of the modules in .htaccess.
What is gzip-page compression
When opening the page, the browser loads files with different extensions. Gzip-compression of HTML-pages applies to the following file formats: .html, .xml, .js, .css. The larger the size of such files, the longer the content loads. If you compress the content, the server will take less time to process them. It submits the files in a compressed form, and the browser unpacks them and issues 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, the submission of files in a compressed form has a positive effect on the ranking of search engines and the loyalty of site visitors.
How to check gzip-site compression
Some hosting providers include compression by default for all their clients, despite server load. On WordPress sites, page content is also compressed immediately. You can check whether the compression technology is connected to your site by the CMS or hosting by using online services. For example, GidZipTest:
In this case, the compression of the contents of the pages reaches 73.2%. If no compression is used, the first line will display No, and the file size will remain unchanged.
Check the download speed of the site online and using the tool PageSpeed Insights from Google. After analysis, the service provides recommendations to increase download speed. Among them is often present advice on compression:
Using these and similar online tools, you can check the level of Gzip compression on the OpenCart sites and other engines. We can not ignore the recommendation on content compression, as it directly affects the SEO-promotion and the visitor’s desire to remain on the site. To achieve maximum efficiency, one compression will be small. It should be used in conjunction with other ways to reduce the weight of the 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 files at the end;
- reduce the number of HTTP requests.
All these steps in the complex will reduce the weight of the page, increase the speed of their loading and will have a positive impact on the ranking.
How to enable gzip compression on apache
Content compression is dynamic and static. In the first embodiment, the data is compressed on the server side when they are in the path to the browser. The obvious advantage of dynamic compression is a significant reduction in the weight and speed of loading pages. Minus – in additional load on the server. Hosting resources can not pull sites with high traffic. You have to switch to a more expensive rate 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:
After opening the file, activate the mod_deflate module by entering commands:
If, after saving the code, the analysis of the download speed of the site again shows no compression, the probable problem may be in the server. Some providers use Apache and Nginx servers gluing. In this case, you can not connect the compression yourself. The solution will be to contact the service hosting provider.
If it is impossible to resolve the issue via mod_deflate, try using another mod_gzip module instead. To do this, add the commands to the .htaccess file:
Check if the module has worked this time.
Static compression is different from dynamic lack of server load. You independently compress each file and load it into the root folder of the site. After that, the server will transmit the data to the browser immediately and in compressed form. Such a step eliminates the need to switch to a more expensive tariff in hosting. But after updating the files, you will have to manually create compressed copies of each new document.
To enable static compression, download all files of the required formats to your computer using the file manager or hosting panel. Next, install the 7-Zip program. Find through the program every file you want to compress. Right-click on each of them and add it to the archive. Select the desired format and click “Save”.
After creating archives of all files, download the compressed versions to the root folder. As a result, it will be compressed and uncompressed versions. To activate static compression, connect the mod_rewrite module to the .htaccess file:
It is necessary to use only one type of compression – dynamic or static. If you connect both methods, in the end, none will work. After the introduction of each module, you need to check the site again for page loading speed and content compression.
How to enable gzip compression on nginx and other servers
You can determine the type of server where the site is located in the hosting admin panel or ask the hosting provider for support. If your site is located on the Nginx server, you need to enter the following fragment in the /etc/nginx/nginx.conf configuration file:
# Gzip Settings
gzip_buffers 16 8k;
Then you need to restart the server.
If the site is located on Beget, IspManager and you could not enable compression by adding a code snippet to .htaccess, contact the hosting support service with the request to enable compression on the server.
How to increase the speed of loading a site on WordPress
To enable Gzip compression in WordPress, in addition to activating modules on the server, you can also use plugins. For example, in Hyper Cache there is a “Compression” function:
When activating this function in the plugin, you do not need to connect modules via the .htaccess file.
Gzip-compression technology is used to speed up the loading of site pages in conjunction with other actions. The use of compression of text data affects the loyalty of visitors and improves the position of the site in the issue. Check Gzip-site compression, you can use online services. To connect, you can use static or dynamic compression.
In the first case, you need to manually create Gzip-archives of each file, thereby reducing the load on the server. In the second variant, it is enough to connect the module to the .htaccess file and check the Gzip compression of HTML pages again. If these changes did not work, contact the hosting provider for help.