Quantcast
Channel: apache – softelメモ
Viewing all articles
Browse latest Browse all 68

.htaccessでキャッシュ制御

$
0
0

問題

Apacheで、キャッシュさせたり、させないようにしたりの制御を .htaccessでさくっとやりたい。

apache-icon

答え

キャッシュさせない設定例

Header set Pragma no-cache
Header set Cache-Control no-cache

特定の拡張子のファイルでキャッシュさせない設定例

<Files ~ "\.(html|php|jpg|jpeg|gif|png)$">
Header set Pragma no-cache
Header set Cache-Control no-cache
</Files>

キャッシュさせる設定例

Header set Cache-Control "max-age=86400"

Viewing all articles
Browse latest Browse all 68

Trending Articles