|
5 | 5 | # Serve resources with a far-future expiration date. |
6 | 6 | # |
7 | 7 | # (!) If you don't control versioning with filename-based cache busting, you |
8 | | -# should consider lowering the cache times to something like one week. |
| 8 | +# should consider lowering the cache times to something like one week. |
9 | 9 | # |
10 | 10 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control |
11 | 11 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires |
|
14 | 14 | <IfModule mod_expires.c> |
15 | 15 |
|
16 | 16 | ExpiresActive on |
17 | | - ExpiresDefault "access plus 1 year" |
18 | | - |
19 | | - # CSS |
20 | | - |
21 | | - ExpiresByType text/css "access plus 1 year" |
22 | | - |
23 | | - |
24 | | - # Data interchange |
25 | | - |
26 | | - ExpiresByType application/atom+xml "access plus 1 hour" |
27 | | - ExpiresByType application/rdf+xml "access plus 1 hour" |
28 | | - ExpiresByType application/rss+xml "access plus 1 hour" |
29 | | - |
30 | | - ExpiresByType application/json "access plus 0 seconds" |
31 | | - ExpiresByType application/ld+json "access plus 0 seconds" |
32 | | - ExpiresByType application/schema+json "access plus 0 seconds" |
33 | | - ExpiresByType application/geo+json "access plus 0 seconds" |
34 | | - ExpiresByType application/xml "access plus 0 seconds" |
35 | | - ExpiresByType text/calendar "access plus 0 seconds" |
36 | | - ExpiresByType text/xml "access plus 0 seconds" |
37 | 17 |
|
| 18 | + # Default: Fallback |
| 19 | + ExpiresDefault "access plus 1 year" |
38 | 20 |
|
39 | | - # Favicon (cannot be renamed!) and cursor images |
40 | | - |
| 21 | + # Specific: Assets |
41 | 22 | ExpiresByType image/vnd.microsoft.icon "access plus 1 week" |
42 | 23 | ExpiresByType image/x-icon "access plus 1 week" |
43 | 24 |
|
44 | | - # HTML |
45 | | - |
46 | | - ExpiresByType text/html "access plus 0 seconds" |
47 | | - |
48 | | - |
49 | | - # JavaScript |
50 | | - |
51 | | - ExpiresByType application/javascript "access plus 1 year" |
52 | | - ExpiresByType application/x-javascript "access plus 1 year" |
53 | | - ExpiresByType text/javascript "access plus 1 year" |
54 | | - |
55 | | - |
56 | | - # Manifest files |
57 | | - |
| 25 | + # Specific: Manifests |
58 | 26 | ExpiresByType application/manifest+json "access plus 1 week" |
59 | | - ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds" |
60 | | - ExpiresByType text/cache-manifest "access plus 0 seconds" |
61 | | - |
62 | | - |
63 | | - # Markdown |
64 | | - |
65 | | - ExpiresByType text/markdown "access plus 0 seconds" |
66 | | - |
67 | | - |
68 | | - # Media files |
69 | | - |
70 | | - ExpiresByType audio/ogg "access plus 1 year" |
71 | | - ExpiresByType image/apng "access plus 1 year" |
72 | | - ExpiresByType image/avif "access plus 1 year" |
73 | | - ExpiresByType image/bmp "access plus 1 year" |
74 | | - ExpiresByType image/gif "access plus 1 year" |
75 | | - ExpiresByType image/jpeg "access plus 1 year" |
76 | | - ExpiresByType image/jxl "access plus 1 year" |
77 | | - ExpiresByType image/png "access plus 1 year" |
78 | | - ExpiresByType image/svg+xml "access plus 1 year" |
79 | | - ExpiresByType image/webp "access plus 1 year" |
80 | | - ExpiresByType video/mp4 "access plus 1 year" |
81 | | - ExpiresByType video/ogg "access plus 1 year" |
82 | | - ExpiresByType video/webm "access plus 1 year" |
83 | | - |
84 | | - |
85 | | - # WebAssembly |
86 | | - |
87 | | - ExpiresByType application/wasm "access plus 1 year" |
88 | | - |
89 | | - |
90 | | - # Web fonts |
91 | | - |
92 | | - # Collection |
93 | | - ExpiresByType font/collection "access plus 1 year" |
94 | | - |
95 | | - # Embedded OpenType (EOT) |
96 | | - ExpiresByType application/vnd.ms-fontobject "access plus 1 year" |
97 | | - ExpiresByType font/eot "access plus 1 year" |
98 | | - |
99 | | - # OpenType |
100 | | - ExpiresByType font/opentype "access plus 1 year" |
101 | | - ExpiresByType font/otf "access plus 1 year" |
102 | | - |
103 | | - # TrueType |
104 | | - ExpiresByType application/x-font-ttf "access plus 1 year" |
105 | | - ExpiresByType font/ttf "access plus 1 year" |
106 | | - |
107 | | - # Web Open Font Format (WOFF) 1.0 |
108 | | - ExpiresByType application/font-woff "access plus 1 year" |
109 | | - ExpiresByType application/x-font-woff "access plus 1 year" |
110 | | - ExpiresByType font/woff "access plus 1 year" |
111 | | - |
112 | | - # Web Open Font Format (WOFF) 2.0 |
113 | | - ExpiresByType application/font-woff2 "access plus 1 year" |
114 | | - ExpiresByType font/woff2 "access plus 1 year" |
| 27 | + ExpiresByType application/x-web-app-manifest+json "access" |
| 28 | + ExpiresByType text/cache-manifest "access" |
115 | 29 |
|
| 30 | + # Specific: Data interchange |
| 31 | + ExpiresByType application/atom+xml "access plus 1 hour" |
| 32 | + ExpiresByType application/rdf+xml "access plus 1 hour" |
| 33 | + ExpiresByType application/rss+xml "access plus 1 hour" |
116 | 34 |
|
117 | | - # Other |
| 35 | + # Specific: Documents |
| 36 | + ExpiresByType text/html "access" |
| 37 | + ExpiresByType text/markdown "access" |
| 38 | + ExpiresByType text/calendar "access" |
118 | 39 |
|
| 40 | + # Specific: Other |
119 | 41 | ExpiresByType text/x-cross-domain-policy "access plus 1 week" |
120 | 42 |
|
| 43 | + # Generic: Data |
| 44 | + ExpiresByType application/json "access" |
| 45 | + ExpiresByType application/ld+json "access" |
| 46 | + ExpiresByType application/schema+json "access" |
| 47 | + ExpiresByType application/geo+json "access" |
| 48 | + ExpiresByType application/xml "access" |
| 49 | + ExpiresByType text/xml "access" |
| 50 | + |
| 51 | + # Generic: WebAssembly |
| 52 | + # ExpiresByType application/wasm "access plus 1 year" # default |
| 53 | + |
| 54 | + # Generic: Assets |
| 55 | + # ExpiresByType application/javascript "access plus 1 year" # default |
| 56 | + # ExpiresByType application/x-javascript "access plus 1 year" # default |
| 57 | + # ExpiresByType text/javascript "access plus 1 year" # default |
| 58 | + # ExpiresByType text/css "access plus 1 year" # default |
| 59 | + |
| 60 | + # Generic: Medias |
| 61 | + # ExpiresByType audio/* "access plus 1 year" # default |
| 62 | + # ExpiresByType image/* "access plus 1 year" # default |
| 63 | + # ExpiresByType video/* "access plus 1 year" # default |
| 64 | + # ExpiresByType font/* "access plus 1 year" # default |
| 65 | + |
121 | 66 | </IfModule> |
0 commit comments