diff options
| author | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-10-03 13:43:17 +0900 |
|---|---|---|
| committer | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-10-03 13:43:17 +0900 |
| commit | 7bae5da6ed0d886ca899a57e3875968262adc491 (patch) | |
| tree | d84a0ab573becef93d755f407cd4edd13fe5edd6 | |
| parent | 391983136309f7ce9546b311d9d46b7636ac7340 (diff) | |
public/.htaccess: /_astro/* と /img/* にキャッシュヘッダを追加
C:/Program Files/Git/_astro/ はハッシュ付きファイル名のため1年 immutable、URLが固定の /img/ は控えめに1週間とした。
| -rw-r--r-- | public/.htaccess | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/public/.htaccess b/public/.htaccess index 4f7954f..0d23203 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -114,3 +114,17 @@ RewriteRule ^books/dyslexia/(.*)$ /about-dyslexia/ [R=301,L] # --- Whisper文字起こしの記事 --- RewriteRule ^blog/moji-okosi-whisper-surprised/?$ /whisper-to-ai-moji-okoshi/ [R=301,L] + +# ============================================================ +# キャッシュヘッダ +# ============================================================ +# /_astro/ 以下のファイル名は内容のハッシュを含み、内容が変わればURLも +# 変わるため、長期間キャッシュして問題ない。 +<IfModule mod_headers.c> + SetEnvIf Request_URI "^/_astro/" long_cache + Header set Cache-Control "public, max-age=31536000, immutable" env=long_cache + + # /img/ 以下はURLが内容と対応しないため、控えめの有効期間にする。 + SetEnvIf Request_URI "^/img/" short_cache + Header set Cache-Control "public, max-age=604800" env=short_cache +</IfModule> |
