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

如何增加WordPress網站的PHP時間限制?

如何增加WordPress網...

PHP時間限制是您的網站在超時之前將花費在單個操作上的時間。當操作達到設置的時間限制時,它將返回錯誤...

RPO(Relative Path Overwrite)相對路徑覆蓋攻擊

RPO(Relative P...

首先,先來用例子說明何謂「相對路徑」何謂「絕對路徑」。 例如你有一個網址為http://www.de...

PDO bindParam 和 bindValue 差別在哪裡?

PDO bindParam ...

首先 bindParam 是綁定變數、bindValue  是綁定值。 以下範例: bindPara...

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