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.ini更改允許上傳檔案的大小

修改php.ini更改允許上...

使用vi或vim開啟php.ini #vim /etc/php/apache/php.ini 找到以...

分享 不得不用的15個神奇熱鍵

分享 不得不用的15個神奇熱...

好吧~我學到了,看看有沒有機會用上。 我承認切換桌面跟把視窗快速隱藏的熱鍵是蠻好用的。 不想被發現的...

javascript獲取當前時間

javascript獲取當前...

watchclock var myDate = new Date(); //獲取當前年 var ye...

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