邪罗刹的菠萝阁


装了WP-Super-Cache插件之后
我加载页面和以前比真是飞似地 ~
原来无浏览器缓存需要8.78s的加载时间
现在居然变成了3.32s
O(∩_∩)O哈哈 下面就分享下安装步骤

安装步骤:
> 到 http://wordpress.org/extend/plugins/wp-super-cache/ 下载最新的插件文件
> 安装到你的Wordpress并且启用它 ON WP Cache and Super Cache enabled
> 推荐打开 Super Cache Compression 进行Gzip的页面传输 但请注意 一部分虚拟主机并不支持
> 将下面“代码段1”加入根目录的.htaccess文件
> 将下面“代码段2”加入wp-content/cache/处的.htaccess文件
> 搞定


代码段1:

# BEGIN WPSuperCache

RewriteEngine On
RewriteBase /

AddDefaultCharset UTF-8
RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f

RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz [L]

RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html -f
RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html [L]

# END WPSuperCache[/sourcecode]
代码段2:

# BEGIN supercache

ForceType text/html
FileETag None

AddEncoding gzip .gz
AddType text/html .gz

SetEnvIfNoCase Request_URI \.gz$ no-gzip

Header set Vary "Accept-Encoding, Cookie"
Header set Cache-Control 'max-age=300, must-revalidate'

ExpiresActive On
ExpiresByType text/html A300

# END supercache[/sourcecode]

Leave a comment
0 Comments.

Leave a Reply


[ Ctrl + Enter ]