提问人:projectmonkey 提问时间:11/10/2023 最后编辑:projectmonkey 更新时间:11/10/2023 访问量:33
如何使用 .htaccess 停止缓存 adsbygoogle.js?
How do I stop caching of adsbygoogle.js using .htaccess?
问:
我正在尝试阻止 adsbygoogle.js 被缓存。理想情况下,我希望其他所有内容仍然被缓存。
目前,我在.htaccess中有以下内容。
# Begin cache control #
<ifModule mod_headers.c>
# One year for image and video files
<filesMatch ".(flv|gif|ico|jpg|jpeg|mp4|mpeg|png|svg|swf|webp)$">
Header set Cache-Control "max-age=31536000, public"
</filesMatch>
# One month for PDF files
<filesMatch ".(pdf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
# One week for CSS files
<filesMatch ".(css)$">
Header set Cache-Control "max-age=604800, public"
</filesMatch>
#no cache for js
<filesMatch "\.(js)$">
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</filesMatch>
</ifModule>
这似乎不起作用,即使它确实有效,它也会阻止缓存任何.js,而我只希望 https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3370240294319443 不被缓存。
我正在通过点击检查然后检查网络选项卡,广告的标头来检查它是否在Chrome中工作google .js?
答: 暂无答案
评论