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.