diff --git a/apps/docs/public/.htaccess b/apps/docs/public/.htaccess
index 15e2cca..4ada281 100644
--- a/apps/docs/public/.htaccess
+++ b/apps/docs/public/.htaccess
@@ -62,7 +62,8 @@ ErrorDocument 404 /persist/404.html
SetEnvIf Request_URI "^/persist/index\.html$" IS_PERSIST_HOME
- Header always set Link "; rel=\"api-catalog\"; type=\"application/linkset+json\", ; rel=\"ai-catalog\"; type=\"application/ai-catalog+json\", ; rel=\"service-desc\"; type=\"application/json\", ; rel=\"describedby\"; type=\"application/json\", ; rel=\"describedby\"; type=\"text/plain\", ; rel=\"alternate\"; type=\"text/markdown\"" env=IS_PERSIST_HOME
+ # expr covers REDIRECT_ rename after internal rewrites (e.g. /persist/index.html -> /persist/index.md).
+ Header always set Link "; rel=\"api-catalog\"; type=\"application/linkset+json\", ; rel=\"ai-catalog\"; type=\"application/ai-catalog+json\", ; rel=\"service-desc\"; type=\"application/json\", ; rel=\"describedby\"; type=\"application/json\", ; rel=\"describedby\"; type=\"text/plain\", ; rel=\"alternate\"; type=\"text/markdown\"" "expr=%{ENV:IS_PERSIST_HOME} || %{ENV:REDIRECT_IS_PERSIST_HOME}"
# Extensionless file needs explicit type (else text/plain fails the scan).
@@ -88,17 +89,17 @@ RewriteRule ^ - [L]
# /persist/ -> /persist/index.md
RewriteCond %{HTTP:Accept} text/markdown [NC]
-RewriteCond %{HTTP:Accept} !text/markdown\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC]
+RewriteCond %{HTTP:Accept} !text/markdown(?:\s*;\s*(?!q\s*=)[^;,]+)*\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC]
RewriteRule ^$ /persist/index.md [L,T=text/markdown]
# /persist/index.html -> /persist/index.md (same representation as /persist/)
RewriteCond %{HTTP:Accept} text/markdown [NC]
-RewriteCond %{HTTP:Accept} !text/markdown\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC]
+RewriteCond %{HTTP:Accept} !text/markdown(?:\s*;\s*(?!q\s*=)[^;,]+)*\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC]
RewriteRule ^index\.html$ /persist/index.md [L,T=text/markdown]
# /persist/ -> twin .md
RewriteCond %{HTTP:Accept} text/markdown [NC]
-RewriteCond %{HTTP:Accept} !text/markdown\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC]
+RewriteCond %{HTTP:Accept} !text/markdown(?:\s*;\s*(?!q\s*=)[^;,]+)*\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC]
RewriteCond %{REQUEST_FILENAME} !\.md$ [NC]
RewriteCond %{DOCUMENT_ROOT}/persist/$1.md -f
RewriteRule ^(.+?)/?$ /persist/$1.md [L,T=text/markdown]