指定缓存验证器并利用 Apache 的浏览器缓存

指定缓存验证器并利用 Apache 的浏览器缓存

我正在尝试提高网站速度并使用 GTMetrix 进行一些分析。我收到了 2 条无法排序的建议。

利用浏览器缓存来获取以下可缓存资源:

https://cellfina.co.uk/favicon.ico (expiration not specified)
https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1102/refill

(未指定有效期) https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1103/refill (未指定有效期) https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1104/refill (未指定有效期) https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1108/refill (未指定有效期) https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1109/refill (未指定有效期) https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1110/refill (未指定有效期) https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1111/refill (未指定有效期) https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1291/refill (未指定有效期) https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1432/refill (未指定有效期) https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/881/refill (未指定有效期) https://www.googletagmanager.com/gtm.js?id=GTM-PS6VCD5(15分钟) https://connect.facebook.net/signals/config/2069824809931530?v=2.8.47&r=stable (20分钟) https://www.google-analytics.com/analytics.js(2小时)

以下资源缺少缓存验证器。未指定缓存验证器的资源无法有效刷新。请指定 Last-Modified 或 ETag 标头以启用以下资源的缓存验证:

https://cellfina.co.uk/favicon.ico
https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1102/refill
https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1103/refill
https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1104/refill
https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1108/refill
https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1109/refill
https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1110/refill
https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1111/refill
https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1291/refill
https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/1432/refill
https://cellfina.co.uk/wp-json/contact-form-7/v1/contact-forms/881/refill
https://connect.facebook.net/signals/config/2069824809931530?v=2.8.47&r=stable

.htaccess文件中我有

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

我希望它能处理jsfavicon文件。

为什么不行?我该如何处理 API 调用?

相关内容