Loading...

使用 .htaccess 關閉緩存

Temperature: 0 °C

Mark ChangMark Chang
author_tools

使用緩存可以提高網站的性能。
可以在.htaccess 文件集標頭中的各種指令指示瀏覽器將文件保留較長時間。
這樣在使用端瀏覽網站時就可以直接使用被緩衝的文件而不用重新查詢資料庫或下載。
這樣網站速度效能會提高許多。

但也許也會有禁用緩衝功能的時候,例如修改網站內容時。
這時我們需要把緩衝功能關閉:

# DISABLE CACHING
<IfModule mod_headers.c>
Header set Cache-Control "no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires 0
</IfModule>

<FilesMatch "\.(css|flv|gif|htm|html|ico|jpe|jpeg|jpg|js|mp3|mp4|png|pdf|swf|txt)$">
<IfModule mod_expires.c>
ExpiresActive Off
</IfModule>
<IfModule mod_headers.c>
FileETag None
Header unset ETag
Header unset Pragma
Header unset Cache-Control
Header unset Last-Modified
Header set Pragma "no-cache"
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Expires "Thu, 1 Jan 1970 00:00:00 GMT"
</IfModule>
</FilesMatch>

以上紀錄。

參考連結Url link

#故事  #htaccess  #禁用緩衝  #apache  
https://innstory.com/story-使用_htaccess_關閉緩存-2724
apache

Prev
 使用htaccess中更改sessionname

Next
Fatal_error_Allowed_memory_size_of_50331648_bytes_exhausted_tried_to_allocate_12288_bytes_in 

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.ini改變以下設定 disablef...

javascript如何取得檔案的副檔名?

javascript如何取得...

var filenamea = "aaa"; alert(getFileExte...

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