我正在重做整个网站,浏览器正在使用处于相同URL的页面的缓存index.html
。如何防止浏览器使用旧的缓存的index.html?
这是.htaccess
文件中的问题的一个目录中的全部内容:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /products/
# Remove 'index.html' from the URL for old links that include it.
RewriteCond %{THE_REQUEST} ^.*\index\.html?\ HTTP/
RewriteRule ^(.*)index\.html?$ "/products/$1" [R=301,L]
# Use index.php for all requests.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule^/products/index.php [L]
</IfModule>
# An atempt to tell the browser not to use a cached .html file.
ExpiresActive on
ExpiresByType text/html "access plus 0 seconds"
<FilesMatch "\.(html)$">
Header set Cache-Control "private, must-revalidate"
</FilesMatch>
我在这里已经试过许多东西,但没有什么工作。这是我在标题中看到的全部内容:
Request URL:http://www.example.com/products/
Request Method:GET
Status Code:200 OK (from cache)
没有请求标头或响应标头。
我在想我可以尝试一个RewriteRule来添加一些类似?28032012
的东西,但我不知道如何尝试。
难道你们就不能修改自己的index.html页面? http://stackoverflow.com/questions/748193/html-php-page-being-cached-client-side-when-it-should-not-be – 2012-03-28 19:59:37
我可以,但我需要尽快推住这个网站可能。 – JDavis 2012-03-28 20:03:42
它看起来像mod_expires根本不工作。您确定您已取消注释LoadModule expires_module模块/ mod_expires.so?在此之前,您应该清除浏览器的临时文件。我希望这有帮助。 – huangli 2012-03-29 02:23:44