htaccess的 - 如何强制客户端的浏览器清除缓存? [英] htaccess - How to force the client's browser to clear the cache?
本文介绍了htaccess的 - 如何强制客户端的浏览器清除缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有关我的网站,我有以下htaccess的规则:
For my site I have the following htaccess rules:
# BEGIN Gzip
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</IfModule>
# END Gzip
# BEGIN EXPIRES
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 10 days"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/plain "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/x-icon "access plus 1 year"
</IfModule>
# END EXPIRES
我刚刚更新了我的网站,它看起来一切扭曲,直到我清除我的缓存。我怎么可以强制客户端浏览器以清除在更新后的缓存,以便用户能看到的变化?
I've just updated my site and it looked all screwy until I cleared my cache. How can I force the client's browser to clear the cache after an update so that the user can see the changes?
推荐答案
您可以强制浏览器缓存的东西,但
You can force browsers to cache something, but
因此,唯一的(AMAIK)的方法是使用一个新网址为您的资源。类似的版本。
Thus the only (AMAIK) way is to use a new URL for your resources. Something like versioning.
这篇关于htaccess的 - 如何强制客户端的浏览器清除缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文