[英]Leveraging browser caching issue
My .htaccess file:我的 .htaccess 文件:
# 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
# Expires Headers - 2678400s = 31 days
<ifmodule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 2678400 seconds"
ExpiresByType text/html "access plus 7200 seconds"
ExpiresByType image/gif "access plus 2678400 seconds"
ExpiresByType image/jpeg "access plus 2678400 seconds"
ExpiresByType image/png "access plus 2678400 seconds"
ExpiresByType text/css "access plus 750000 seconds"
ExpiresByType text/javascript "access plus 2678400 seconds"
ExpiresByType application/x-javascript "access plus 2678400 seconds"
</ifmodule>
# Cache Headers
<ifmodule mod_headers.c>
# Cache specified files for 31 days
<filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf)$">
Header set Cache-Control "max-age=2678400, public"
</filesmatch>
# Cache HTML files for a couple hours
<filesmatch "\.(html|htm)$">
Header set Cache-Control "max-age=7200, private, must-revalidate"
</filesmatch>
# Cache PDFs for a day
<filesmatch "\.(pdf)$">
Header set Cache-Control "max-age=86400, public"
</filesmatch>
# Cache Javascripts for 31 days
<filesmatch "\.(js)$">
Header set Cache-Control "max-age=2678400, private"
</filesmatch>
</ifmodule>
www.gtmetrix.com accept my leverage browser cache, but google page speed does not accept that files : www.gtmetrix.com 接受我的杠杆浏览器缓存,但谷歌页面速度不接受该文件:
https://apis.google.com/js/api.js (30 dakika)
https://apis.google.com/js/platform.js (30 dakika)
http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js (60 dakika)
http://pagead2.googlesyndication.com/pagead/osd.js (60 dakika)
https://oauth.googleusercontent.com/…e:rpc:shindig.random:shindig.sha1.js?c=2 (60 dakika)
http://www.google-analytics.com/analytics.js (2 saat)
How to fix this problem.如何解决这个问题。 I tried cache plugins like super cache, total cache, fast cache.我尝试了缓存插件,如超级缓存、总缓存、快速缓存。 But those are decrease my google page speed score.但这些会降低我的谷歌页面速度得分。 Now my google page speed score is 87/100 and gtmetrix 93/100.现在我的谷歌页面速度得分是 87/100 和 gtmetrix 93/100。
My web site is : www.guzellikperisi.com我的网站是:www.guzellikperisi.com
Those scripts are off server, so your .htaccess file does not apply to them - not much you can do.这些脚本不在服务器上,因此您的 .htaccess 文件不适用于它们 - 您无能为力。
To be honest, I only use page speeds as suggestions.老实说,我只使用页面速度作为建议。 I never fully rely on page scores.我从不完全依赖页面分数。 Even if you look at big sites like ign.com or newyorktimes.com they don't have great scores.即使您查看像 ign.com 或 newyorktimes.com 这样的大型网站,它们的得分也不高。
Pick and choose what you want to improve.挑选并选择您想要改进的内容。 Yes it's good to strive for perfection, but it just depends on your site.是的,追求完美是件好事,但这取决于您的网站。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.