How to enable GZIP compression for wordpress

Source: Internet
Author: User

Method 1: plug-in GZippy with the download address attached.

Http://wordpress.org/extend/plugins/gzippy/

Plug-ins are the easiest to use. You can enable them after installation. Your blog may bring some cache plug-ins with the gzip function. Please be careful not to use mixed-up.

Method 2: paste the following code into the function. Php file.

The code is as follows: Copy code

Function gzippy (){
Ob_start ('OB _ gzhandler ');
}

If (! Stristr ($ _ SERVER ['request _ URI '], 'tinymce ')&&! Ini_get ('zlib. Output_compression ')){
Add_action ('init ', 'gzippy ');
}

Method 3: enable gzip on the apache/iis server

The following lines are found in http. conf. If not, add

# LoadModule deflate_module modules/mod_deflate.so remove. Indicates that GZIP is enabled.

The compression function is enabled. It can be used very well. For more detailed customization, see the following:

You can add this section after http. conf for customization: (if not necessary, use the default one)

The code is as follows: Copy code

<Ifmodule mod_deflate.c>
DeflateCompressionLevel 9
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php
AddOutputFilter DEFLATE js css
</Ifmodule>

DeflateCompressionLevel 9 refers to the compression level, from 1 to 9, 9 is the highest level. It is understood that this can reduce the transmission volume by up to 8 characters (depending on the file content), and reduce the transmission volume by at least half.


Currently, the above two methods are the simplest and practical. You can choose one of them. After setting, use the webmaster tool to verify whether your wordpress has enabled GZIP compression.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.