2017-09-19 95 views
2

我想在wordpress站點上設置壓縮。 Google搜索了一百個詞條,嘗試了所有我能找到的東西。 試過插件,試圖用多種方式修改.htaccess文件。 像這樣:gzip在wordpress站點上的壓縮

<IfModule mod_deflate.c> 
# Compress HTML, CSS, JavaScript, Text, XML and fonts 
AddOutputFilterByType DEFLATE application/javascript 
AddOutputFilterByType DEFLATE application/rss+xml 
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject 
AddOutputFilterByType DEFLATE application/x-font 
AddOutputFilterByType DEFLATE application/x-font-opentype 
AddOutputFilterByType DEFLATE application/x-font-otf 
AddOutputFilterByType DEFLATE application/x-font-truetype 
AddOutputFilterByType DEFLATE application/x-font-ttf 
AddOutputFilterByType DEFLATE application/x-javascript 
AddOutputFilterByType DEFLATE application/xhtml+xml 
AddOutputFilterByType DEFLATE application/xml 
AddOutputFilterByType DEFLATE font/opentype 
AddOutputFilterByType DEFLATE font/otf 
AddOutputFilterByType DEFLATE font/ttf 
AddOutputFilterByType DEFLATE image/svg+xml 
AddOutputFilterByType DEFLATE image/x-icon 
AddOutputFilterByType DEFLATE text/css 
AddOutputFilterByType DEFLATE text/html 
AddOutputFilterByType DEFLATE text/javascript 
AddOutputFilterByType DEFLATE text/plain 
AddOutputFilterByType DEFLATE text/xml 

# Removing browser bugs for older browsers 
BrowserMatch ^Mozilla/4 gzip-only-text/html 
BrowserMatch ^Mozilla/4\.0[678] no-gzip 
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html 
Header append Vary User-Agent 
</IfModule> 

像這樣:

<ifModule mod_gzip.c> 
mod_gzip_on Yes 
mod_gzip_dechunk Yes 
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$ 
mod_gzip_item_include mime ^application/x-javascript.* 
mod_gzip_item_include mime ^text/.* 
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* 
mod_gzip_item_exclude mime ^image/.* 
mod_gzip_item_include handler ^cgi-script$ 
</ifModule> 

即使是這樣的:

<IfModule mod_deflate.c> 
    <IfModule mod_setenvif.c> 
     <IfModule mod_headers.c> 
      SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding 
      RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding 
     </IfModule> 
    </IfModule> 
    <IfModule mod_filter.c> 
     AddOutputFilterByType DEFLATE "application/atom+xml" \ 
    "application/javascript" \ 
    "application/json" \ 
    "application/ld+json" \ 
    "application/manifest+json" \ 
    "application/rdf+xml" \ 
    "application/rss+xml" \ 
    "application/schema+json" \ 
    "application/vnd.geo+json" \ 
    "application/vnd.ms-fontobject" \ 
    "application/x-font-ttf" \ 
    "application/x-javascript" \ 
    "application/x-web-app-manifest+json" \ 
    "application/xhtml+xml" \ 
    "application/xml" \ 
    "font/eot" \ 
    "font/opentype" \ 
    "image/bmp" \ 
    "image/svg+xml" \ 
    "image/vnd.microsoft.icon" \ 
    "image/x-icon" \ 
    "text/cache-manifest" \ 
    "text/css" \ 
    "text/html" \ 
    "text/javascript" \ 
    "text/plain" \ 
    "text/vcard" \ 
    "text/vnd.rim.location.xloc" \ 
    "text/vtt" \ 
    "text/x-component" \ 
    "text/x-cross-domain-policy" \ 
    "text/xml" 

    </IfModule> 
    <IfModule mod_mime.c> 
     AddEncoding gzip    svgz 
    </IfModule> 

</IfModule> 

我檢查的phpinfo設置,模塊被激活

gzip compression enabled 

_SERVER["HTTP_ACCEPT_ENCODING"] gzip, deflate 

但作爲結果 - 噸他只有gzip文件是谷歌字體和cdn js庫。網站內部的所有內容都一樣。

任何想法我失蹤了?

試圖讓這一個 -

http://terminaltuning.ru/ 
http://kurgan.terminaltuning.ru/ 
http://tyumen.terminaltuning.ru/ 
+1

你已經設置了AllowOv把'None'設爲'AllowOverride All'? – Lag

回答

0

原來的問題是在nginx的配置

其被打開

gzip on 

而且類型了評論

# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;