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

使用PHP取得目前網址方式

使用PHP取得目前網址方式

pexelsphoto55 使用PHP取得網址相關的方式有下列幾種: $SERVER["R...

點選檔案下載卻直接執行開啟

點選檔案下載卻直接執行開啟

遇到一個情況。 使用者開啟瀏覽器點選某個連結檔案時,不會執行下載而是直接開啟檔案。 原本如果只是圖片...

Android 禁止螢幕旋轉

Android 禁止螢幕旋轉...

首先找到AndroidManifest.xml檔案 位置在app/manifests/路徑底下 在 ...

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