WP Super Cache max-age=3调整

WP Super Cache是来自Automattic开发的WordPress最为流行的缓存插件。

调整前的Headers

HTTP/1.1 200 OK
Date: Tue, 02 Oct 2018 09:27:06 GMT
Server: Apache/2.2.15 (CentOS)
Strict-Transport-Security: max-age=16070400; includeSubDomains
Last-Modified: Tue, 02 Oct 2018 09:26:51 GMT
Accept-Ranges: bytes
Content-Length: 14847
Cache-Control: max-age=3, must-revalidate
Expires: Tue, 02 Oct 2018 09:27:09 GMT
X-UA-Compatible: IE=edge
P3P: policyref="/w3c/p3p.xml", CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Vary: Accept-Encoding,Cookie
Connection: close
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip

注意 Cache-Control: max-age=3, must-revalidate 中的 max-age=3,这个应该怎么调整呢?修改 wp-content/cache/.htaccess文件,将:

# BEGIN INDEX
Options -Indexes
# END INDEX
# BEGIN supercache
<IfModule mod_mime.c>
  <FilesMatch "\.html\.gz$">
    ForceType text/html
    FileETag None
  </FilesMatch>
  AddEncoding gzip .gz
  AddType text/html .gz
</IfModule>
<IfModule mod_deflate.c>
  SetEnvIfNoCase Request_URI \.gz$ no-gzip
</IfModule>
<IfModule mod_headers.c>
  Header set Vary 'Accept-Encoding, Cookie'
  Header set Cache-Control 'max-age=3, must-revalidate'
</IfModule>
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/html A3
</IfModule>
Options -Indexes

# END supercache

改为:

# BEGIN INDEX
Options -Indexes
# END INDEX
# BEGIN supercache
<IfModule mod_mime.c>
  <FilesMatch "\.html\.gz$">
    ForceType text/html
    FileETag None
  </FilesMatch>
  AddEncoding gzip .gz
  AddType text/html .gz
</IfModule>
<IfModule mod_deflate.c>
  SetEnvIfNoCase Request_URI \.gz$ no-gzip
</IfModule>
<IfModule mod_headers.c>
  Header set Vary 'Accept-Encoding, Cookie'
  Header set Cache-Control 'max-age=15768001, must-revalidate'
</IfModule>
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/html A604800
</IfModule>
Options -Indexes

# END supercache

发表评论

电子邮件地址不会被公开。 必填项已用*标注