事实证明,在虚拟主机级别的重载<If>
之后应用了LogLevel rewrite:trace8
。我还能如何包装所有这些设置?
<If "'%{HTTP_USER_AGENT}' == 'Amazon CloudFront' && -n '%{HTTP:X-Amz-Cf-Id}' && -n '%{HTTP:Via}'">
RewriteRule "^" - [NE,E=AMAZONCDN:1]
# Separate robots.txt
# https://support.google.com/webmasters/answer/6062596
RewriteRule "^/robots\.txt$" "/robots-cdn.txt" [END]
# Canonical header
RewriteRule "^" - [NE,E=CANONICAL:%{REQUEST_SCHEME}://${SITE_DOMAIN}%{REQUEST_URI}]
Header set "Link" '<%{CANONICAL}e>; rel="canonical"' env=CANONICAL
# Cache header
Header merge "Cache-Control" "public, immutable"
# CORS header
Header set "Access-Control-Allow-Origin" "https://${SITE_DOMAIN}"
</If>