1
- # Apache Server Configs v5.0 .0 | MIT License
1
+ # Apache Server Configs v5.1 .0 | MIT License
2
2
# https://github.com/h5bp/server-configs-apache
3
3
4
4
# (!) Using `.htaccess` files slows down Apache, therefore, if you have
5
- # access to the main server configuration file (which is usually called
6
- # `httpd.conf`), you should add this logic there.
5
+ # access to the main server configuration file (which is usually
6
+ # called `httpd.conf`), you should add this logic there.
7
7
#
8
- # https://httpd.apache.org/docs/current/howto/htaccess.html
8
+ # https://httpd.apache.org/docs/current/howto/htaccess.html
9
9
10
10
# ######################################################################
11
11
# # CROSS-ORIGIN #
@@ -883,6 +883,7 @@ ServerSignature Off
883
883
"image/bmp" \
884
884
"image/svg+xml" \
885
885
"image/vnd.microsoft.icon" \
886
+ "image/x-icon" \
886
887
"text/cache-manifest" \
887
888
"text/calendar" \
888
889
"text/css" \
@@ -939,7 +940,7 @@ ServerSignature Off
939
940
#
940
941
# https://httpd.apache.org/docs/current/mod/mod_brotli.html#precompressed
941
942
942
- # <IfModule mod_headers .c>
943
+ # <IfModule mod_rewrite .c>
943
944
944
945
# RewriteCond %{HTTP:Accept-Encoding} br
945
946
# RewriteCond %{REQUEST_FILENAME}\.br -f
@@ -969,13 +970,17 @@ ServerSignature Off
969
970
# .json.br
970
971
# </IfModule>
971
972
972
- # # Force proxies to cache brotlied and non-brotlied files separately
973
- # Header append Vary Accept-Encoding
973
+ # <IfModule mod_headers.c>
974
+ # # Force proxies to cache brotlied and non-brotlied files separately
975
+ # Header append Vary Accept-Encoding
976
+ # </IfModule>
974
977
975
978
# </FilesMatch>
976
979
977
- # # Serve correct encoding type
978
- # AddEncoding br .br
980
+ # <IfModule mod_mime.c>
981
+ # # Serve correct encoding type
982
+ # AddEncoding br .br
983
+ # </IfModule>
979
984
980
985
# </IfModule>
981
986
@@ -997,7 +1002,7 @@ ServerSignature Off
997
1002
# keep the default behavior regarding .gz files.
998
1003
# https://httpd.apache.org/docs/current/mod/mod_mime.html#removetype
999
1004
1000
- # <IfModule mod_headers .c>
1005
+ # <IfModule mod_rewrite .c>
1001
1006
1002
1007
# RewriteCond %{HTTP:Accept-Encoding} gzip
1003
1008
# RewriteCond %{REQUEST_FILENAME}\.gz -f
@@ -1008,7 +1013,6 @@ ServerSignature Off
1008
1013
1009
1014
# <FilesMatch "\.gz$">
1010
1015
1011
- # # Serve correct content types
1012
1016
# <IfModule mod_mime.c>
1013
1017
# # (1)
1014
1018
# RemoveType gz
@@ -1028,13 +1032,17 @@ ServerSignature Off
1028
1032
# .json.gz
1029
1033
# </IfModule>
1030
1034
1031
- # # Force proxies to cache gzipped and non-gzipped files separately
1032
- # Header append Vary Accept-Encoding
1035
+ # <IfModule mod_headers.c>
1036
+ # # Force proxies to cache gzipped and non-gzipped files separately
1037
+ # Header append Vary Accept-Encoding
1038
+ # </IfModule>
1033
1039
1034
1040
# </FilesMatch>
1035
1041
1036
- # # Serve correct encoding type
1037
- # AddEncoding gzip .gz
1042
+ # <IfModule mod_mime.c>
1043
+ # # Serve correct encoding type
1044
+ # AddEncoding gzip .gz
1045
+ # </IfModule>
1038
1046
1039
1047
# </IfModule>
1040
1048
@@ -1076,6 +1084,9 @@ ServerSignature Off
1076
1084
1077
1085
# Remove `ETags` as resources are sent with far-future expires headers.
1078
1086
#
1087
+ # Apache `ETags` might have an unexpected behavior if `DeflateAlterETag`
1088
+ # can't be changed (which is the case at `.htaccess` level).
1089
+ #
1079
1090
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
1080
1091
# https://developer.yahoo.com/performance/rules.html#etags
1081
1092
# https://tools.ietf.org/html/rfc7232#section-2.3
@@ -1103,7 +1114,7 @@ FileETag None
1103
1114
<IfModule mod_expires.c >
1104
1115
1105
1116
ExpiresActive on
1106
- ExpiresDefault "access plus 1 month "
1117
+ ExpiresDefault "access plus 1 year "
1107
1118
1108
1119
# CSS
1109
1120
@@ -1156,20 +1167,20 @@ FileETag None
1156
1167
1157
1168
# Media files
1158
1169
1159
- ExpiresByType audio/ogg "access plus 1 month "
1160
- ExpiresByType image/apng "access plus 1 month "
1161
- ExpiresByType image/avif "access plus 1 month "
1162
- ExpiresByType image/avif-sequence "access plus 1 month "
1163
- ExpiresByType image/bmp "access plus 1 month "
1164
- ExpiresByType image/gif "access plus 1 month "
1165
- ExpiresByType image/jpeg "access plus 1 month "
1166
- ExpiresByType image/jxl "access plus 1 month "
1167
- ExpiresByType image/png "access plus 1 month "
1168
- ExpiresByType image/svg+xml "access plus 1 month "
1169
- ExpiresByType image/webp "access plus 1 month "
1170
- ExpiresByType video/mp4 "access plus 1 month "
1171
- ExpiresByType video/ogg "access plus 1 month "
1172
- ExpiresByType video/webm "access plus 1 month "
1170
+ ExpiresByType audio/ogg "access plus 1 year "
1171
+ ExpiresByType image/apng "access plus 1 year "
1172
+ ExpiresByType image/avif "access plus 1 year "
1173
+ ExpiresByType image/avif-sequence "access plus 1 year "
1174
+ ExpiresByType image/bmp "access plus 1 year "
1175
+ ExpiresByType image/gif "access plus 1 year "
1176
+ ExpiresByType image/jpeg "access plus 1 year "
1177
+ ExpiresByType image/jxl "access plus 1 year "
1178
+ ExpiresByType image/png "access plus 1 year "
1179
+ ExpiresByType image/svg+xml "access plus 1 year "
1180
+ ExpiresByType image/webp "access plus 1 year "
1181
+ ExpiresByType video/mp4 "access plus 1 year "
1182
+ ExpiresByType video/ogg "access plus 1 year "
1183
+ ExpiresByType video/webm "access plus 1 year "
1173
1184
1174
1185
1175
1186
# WebAssembly
@@ -1180,28 +1191,28 @@ FileETag None
1180
1191
# Web fonts
1181
1192
1182
1193
# Collection
1183
- ExpiresByType font/collection "access plus 1 month "
1194
+ ExpiresByType font/collection "access plus 1 year "
1184
1195
1185
1196
# Embedded OpenType (EOT)
1186
- ExpiresByType application/vnd.ms-fontobject "access plus 1 month "
1187
- ExpiresByType font/eot "access plus 1 month "
1197
+ ExpiresByType application/vnd.ms-fontobject "access plus 1 year "
1198
+ ExpiresByType font/eot "access plus 1 year "
1188
1199
1189
1200
# OpenType
1190
- ExpiresByType font/opentype "access plus 1 month "
1191
- ExpiresByType font/otf "access plus 1 month "
1201
+ ExpiresByType font/opentype "access plus 1 year "
1202
+ ExpiresByType font/otf "access plus 1 year "
1192
1203
1193
1204
# TrueType
1194
- ExpiresByType application/x-font-ttf "access plus 1 month "
1195
- ExpiresByType font/ttf "access plus 1 month "
1205
+ ExpiresByType application/x-font-ttf "access plus 1 year "
1206
+ ExpiresByType font/ttf "access plus 1 year "
1196
1207
1197
1208
# Web Open Font Format (WOFF) 1.0
1198
- ExpiresByType application/font-woff "access plus 1 month "
1199
- ExpiresByType application/x-font-woff "access plus 1 month "
1200
- ExpiresByType font/woff "access plus 1 month "
1209
+ ExpiresByType application/font-woff "access plus 1 year "
1210
+ ExpiresByType application/x-font-woff "access plus 1 year "
1211
+ ExpiresByType font/woff "access plus 1 year "
1201
1212
1202
1213
# Web Open Font Format (WOFF) 2.0
1203
- ExpiresByType application/font-woff2 "access plus 1 month "
1204
- ExpiresByType font/woff2 "access plus 1 month "
1214
+ ExpiresByType application/font-woff2 "access plus 1 year "
1215
+ ExpiresByType font/woff2 "access plus 1 year "
1205
1216
1206
1217
1207
1218
# Other
0 commit comments