Loading...

使用.htaccess關閉特定文件的緩存

Temperature: 0 °C

Mark ChangMark Chang
author_tools

以特定檔案為例

<Files page.php>
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"
</Files>

或者以特定的文件選擇為目標
<filesMatch "\.(html|htm|js|css|php)$">
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>

反之若是要針對特定文件或檔案去做cache也是可以用同樣的方式。

以上紀錄~
 

More chapters / Next article: 如何緩存靜態資源使用HTTP緩存

https://innstory.com/story-使用htaccess關閉特定文件的緩存-2470
apache

Prev
 分享_首度載人試飛成功!日本新創SkyDrive拚2023年造出飛天計程車、30年後人人可搭|數位時代

Next
如何緩存靜態資源使用HTTP緩存 

About the Author

Mark Chang

離不開電腦的宅男

Visitor message

Leave some footprints to prove that you visited me

Recommended reading

Author's other related stories

Linux vi修改文件時遇到:E212無法打開文件進行寫入

Linux vi修改文件時遇...

執行修改 vi /etc/ssh/sshdconfig 使用wq(儲存後離開)或者是wq!(唯讀檔案...

Android Fragment及Activity 中使用sharedpreferences

Android Fragme...

在Android下想要儲存執行資料的方式有好幾種,例如存在手機空間或者是資料庫空間。 這裡紀錄一下使...

mysql 查詢數據資料是否有重複

mysql 查詢數據資料是否...

pexelsphoto5 有沒有試過資料庫裡上萬筆資料卻不知道是不是有重複的數據? 這時你一定要試試...

Please select an option

error

Hi, thank you for your participation, but you cannot vote repeatedly~

Join innstory now and start recording your story.

"Innstory" is a place to store stories. We are committed to becoming a warm platform. Deepening the bonds between people is our direction.
We are convinced that the blockchain between people is not just a cold calculation. Join us now.

Wrong format