WordPress .htaccess mod_expires

快速的问题。 我试图在启用了SSL的Apache上启用浏览器caching。 我用sudo a2enmod expires安装了mod_expires sudo a2enmod expires (我validation了启用并在/ etc / apache2 / mods-enabled上列出)我按照GTMetrix的build议编辑了.htaccess文件

我的.htaccess(我通过取消注释重写规则和查看页面进入脱机状态来validation它被访问)如下所示:

 # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress # Browser Caching Start # <IfModule mod_expires.c> # Enable expirations ExpiresActive On # Default directive ExpiresDefault "access plus 1 month" # My favicon ExpiresByType image/x-icon "access plus 1 year" # Images ExpiresByType image/gif "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType image/jpg "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" # CSS ExpiresByType text/css "access plus 1 month" # Javascript ExpiresByType application/javascript "access plus 1 year" </IfModule> # Browser Caching End # 

重新启动apache并在Google和GTMetrix上进行testing。 我一直在“利用浏览器caching”显示图像在4小时内过期。

https … / image.png(4小时)

任何build议,如何debugging,或者你看到我做错了什么?

以下是其中一个图像的http响应标头:

 Content-Length: 13937 Connection: keep-alive Set-Cookie: __cfduid=dc6febbc08cc78186b2444352064d20611481224874; expires=Fri, 08-Dec-17 19:21:14 GMT; path=/; domain=.mydomain.com; HttpOnly Strict-Transport-Security: max-age=63072000; includeSubdomains X-Frame-Options: DENY X-Content-Type-Options: nosniff Last-Modified: Wed, 07 Dec 2016 05:20:33 GMT ETag: "3671-5430aae243b0e" Cache-Control: public, max-age=2592000 Expires: Sat, 07 Jan 2017 19:21:14 GMT X-Content-Type-Options: nosniff CF-Cache-Status: MISS Accept-Ranges: bytes Server: cloudflare-nginx CF-RAY: 30e294493e2f3fd7-YUL 

我看到“Expires:Sat,07 Jan”,所以它应该是一个月,但Google一直在写4个小时? 这里发生了什么? 🙂