2013-10-10 23 views
1

這緩存過期是我.htaccess文件,我從互聯網上竊取和調整了一下如何設置的index.html

<ifModule mod_headers.c> 
    Header set Connection keep-alive 
    <filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$"> 
    Header set Cache-Control "max-age=2592000, public" 
    </filesMatch> 
    <filesMatch "\\.(css)$"> 
    Header set Cache-Control "max-age=604800, public" 
    </filesMatch> 
    <filesMatch "\\.(js)$"> 
    Header set Cache-Control "max-age=604800, private" 
    </filesMatch> 
    <filesMatch "\\.(xml|txt)$"> 
    Header set Cache-Control "max-age=86400, public, must-revalidate" 
    </filesMatch> 
    <filesMatch "\\.(html|htm|php)$"> 
    Header set Cache-Control "max-age=86400, private, must-revalidate" 
    </filesMatch> 
</ifModule> 

我用這對我statik博客的部分。我想以不同的方式處理index.html文件,並將max-age設置爲3600.但我不知道.htaccess文件的工作方式。

回答

1

可以在結尾處添加這段代碼:

<filesMatch "index\.html$"> 
    Header set Cache-Control "max-age=3600, private, must-revalidate" 
</filesMatch> 
相關問題