The effect of Gzip compression on the loading time of the webpage is still great. The data transmission volume of the webpage after Gzip compression is generally reduced by more than 70% than that before compression. Therefore, many PHP programs enable Gzip compression to save traffic and speed up page loading. There are many ways to enable Gzip compression for web pages. for my independent server, it is better to enable corresponding options directly in php. ini. However, if you have enabled Gzip in all running PHP programs
The effect of Gzip compression on the loading time of the webpage is still great. The data transmission volume of the webpage after Gzip compression is generally reduced by more than 70% than that before compression. Therefore, many PHP programs enable Gzip compression to save traffic and speed up page loading.
There are many ways to enable Gzip compression for web pages. for my independent server, it is better to enable corresponding options directly in php. ini. However, if you do this, you have to disable the Gzip option in all running PHP programs. Otherwise, an error is reported.
I didn't want to bother with those settings, so I found a method to use. htaccess to control a single website to enable Gzip output.
The method is simple.Under the root directory of the website, Create a. htaccess file (edit it if it has been created). enter the following line of code in any row of the file and save the code to enable the Gzip output of the corresponding website:
Php_value output_handler ob_gzhandler
How is it? It's easy. after such a small change, the access speed to your website will be much faster, and the traffic transmission will be saved.
- Previous article: Let Ubuntu Server use wireless