1- # Apache Server Configs v5.0 .0 | MIT License
1+ # Apache Server Configs v5.1 .0 | MIT License
22# https://github.com/h5bp/server-configs-apache
33
44# (!) 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.
77#
8- # https://httpd.apache.org/docs/current/howto/htaccess.html
8+ # https://httpd.apache.org/docs/current/howto/htaccess.html
99
1010# ######################################################################
1111# # CROSS-ORIGIN #
@@ -883,6 +883,7 @@ ServerSignature Off
883883 "image/bmp" \
884884 "image/svg+xml" \
885885 "image/vnd.microsoft.icon" \
886+ "image/x-icon" \
886887 "text/cache-manifest" \
887888 "text/calendar" \
888889 "text/css" \
@@ -939,7 +940,7 @@ ServerSignature Off
939940#
940941# https://httpd.apache.org/docs/current/mod/mod_brotli.html#precompressed
941942
942- # <IfModule mod_headers .c>
943+ # <IfModule mod_rewrite .c>
943944
944945# RewriteCond %{HTTP:Accept-Encoding} br
945946# RewriteCond %{REQUEST_FILENAME}\.br -f
@@ -969,13 +970,17 @@ ServerSignature Off
969970# .json.br
970971# </IfModule>
971972
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>
974977
975978# </FilesMatch>
976979
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>
979984
980985# </IfModule>
981986
@@ -997,7 +1002,7 @@ ServerSignature Off
9971002# keep the default behavior regarding .gz files.
9981003# https://httpd.apache.org/docs/current/mod/mod_mime.html#removetype
9991004
1000- # <IfModule mod_headers .c>
1005+ # <IfModule mod_rewrite .c>
10011006
10021007# RewriteCond %{HTTP:Accept-Encoding} gzip
10031008# RewriteCond %{REQUEST_FILENAME}\.gz -f
@@ -1008,7 +1013,6 @@ ServerSignature Off
10081013
10091014# <FilesMatch "\.gz$">
10101015
1011- # # Serve correct content types
10121016# <IfModule mod_mime.c>
10131017# # (1)
10141018# RemoveType gz
@@ -1028,13 +1032,17 @@ ServerSignature Off
10281032# .json.gz
10291033# </IfModule>
10301034
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>
10331039
10341040# </FilesMatch>
10351041
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>
10381046
10391047# </IfModule>
10401048
@@ -1076,6 +1084,9 @@ ServerSignature Off
10761084
10771085# Remove `ETags` as resources are sent with far-future expires headers.
10781086#
1087+ # Apache `ETags` might have an unexpected behavior if `DeflateAlterETag`
1088+ # can't be changed (which is the case at `.htaccess` level).
1089+ #
10791090# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
10801091# https://developer.yahoo.com/performance/rules.html#etags
10811092# https://tools.ietf.org/html/rfc7232#section-2.3
@@ -1103,7 +1114,7 @@ FileETag None
11031114<IfModule mod_expires.c >
11041115
11051116 ExpiresActive on
1106- ExpiresDefault "access plus 1 month "
1117+ ExpiresDefault "access plus 1 year "
11071118
11081119 # CSS
11091120
@@ -1156,20 +1167,20 @@ FileETag None
11561167
11571168 # Media files
11581169
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 "
11731184
11741185
11751186 # WebAssembly
@@ -1180,28 +1191,28 @@ FileETag None
11801191 # Web fonts
11811192
11821193 # Collection
1183- ExpiresByType font/collection "access plus 1 month "
1194+ ExpiresByType font/collection "access plus 1 year "
11841195
11851196 # 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 "
11881199
11891200 # 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 "
11921203
11931204 # 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 "
11961207
11971208 # 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 "
12011212
12021213 # 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 "
12051216
12061217
12071218 # Other
0 commit comments