Skip to content

Commit f695071

Browse files
committed
fix: disable MultiViews so extensionless docs URLs always serve HTML
1 parent cfe8a9e commit f695071

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

documentation/.vuepress/public/.htaccess

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,24 @@ Header set Content-Type "text/markdown; charset=UTF-8"
1616

1717
</IfModule>
1818

19-
# Content negotiation: prefer HTML by default for extensionless URLs.
20-
# Markdown is a fallback variant (low source quality), so browsers get .html
21-
# and only clients explicitly requesting text/markdown receive the .md variant.
19+
# Extensionless URLs always resolve to HTML — no content negotiation.
20+
# Disabling MultiViews removes the .html/.md ambiguity entirely, so an
21+
# extensionless URL has exactly one variant. This makes responses safely
22+
# cacheable behind Cloudflare (which ignores `Vary: accept`) and removes the
23+
# "first fetch wins" race. Markdown stays reachable at its explicit .md URL
24+
# (discoverable via llms.txt and the .md sibling convention) for AI agents.
25+
Options -MultiViews
26+
27+
<IfModule mod_rewrite.c>
28+
RewriteEngine On
29+
30+
# Serve foo.html for an extensionless request to /foo, when foo.html exists.
31+
RewriteCond %{REQUEST_FILENAME} !-f
32+
RewriteCond %{REQUEST_FILENAME} !-d
33+
RewriteCond %{REQUEST_FILENAME}\.html -f
34+
RewriteRule ^(.+?)/?$ $1.html [L]
35+
</IfModule>
36+
2237
<IfModule mod_mime.c>
23-
AddType text/html .html
24-
AddType "text/markdown;qs=0.4" .md
38+
AddType text/markdown .md
2539
</IfModule>

0 commit comments

Comments
 (0)