サイトの高速化③ブラウザキャッシュとgzip圧縮

.htaccessにブラウザキャッシュとgzip圧縮を追記します

[blogcard url=”http://www.derekiwasiuk.com/fasterwordpress/#leverage-browser-caching”]

## EXPIRES CACHING ##

<IfModule mod_expires.c>

ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"

</IfModule>

## EXPIRES CACHING ##

<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 handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

</ifModule>

mixhostがgzip圧縮に哀悼しているかは知りませんが とりあえずこれだけでGtmetrixはACにはなりました。こうかてきめん。

残念ながらlemonedの方は、DFのままでした(こちらは先にWPPを停止してDFの状態でした) ただこちらは広告のせいで大怒られなんでそっちの解決が先。

[wp-svg-icons custom_icon="pointer" wrap="i"] 下記サイトで圧縮されてるか確認できます [blogcard url=”http://www.whatsmyip.org/http-compression-test/”]

追記

どうやら.htaccessをいじるとダメなようです Litespeed Cacheプラグインがすでに何かしているようなので書き加えると消せとエラーが出てしまいました

ERROR 4010: In .htaccess file found one unexpected cache rule ExpiresDefault left by other cache plugins. Please remove it to get LiteSpeed Cache Plugin work well.

取り急ぎ・・・何も見れてないのでまだ消してません。FileZillaで見たら、.htaccessのバックアップのようなファイルが増えてました