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.