diff --git a/apps/docs/public/.htaccess b/apps/docs/public/.htaccess index a8e967f..44c7fae 100644 --- a/apps/docs/public/.htaccess +++ b/apps/docs/public/.htaccess @@ -44,3 +44,53 @@ ErrorDocument 404 /codemap/404.html Header set X-Robots-Tag "noindex" + +# Agent discovery (isitagentready) — Apache port of dist/_headers. +# Apache ignores that file; this is what actually ships headers under /codemap. + + AddType application/json .json + AddType application/gzip .tar.gz + + +# Homepage Link header (RFC 8288 / RFC 9727 s3). Minimal form; keep in sync with dist/_headers. + + SetEnvIf Request_URI "^/codemap/$" IS_CODEMAP_HOME + SetEnvIf Request_URI "^/codemap/index\.html$" IS_CODEMAP_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_CODEMAP_HOME + + +# Extensionless file needs explicit type (else text/plain fails the scan). + + ForceType 'application/linkset+json; profile="https://www.rfc-editor.org/info/rfc9727"' + + + + + Header set Access-Control-Allow-Origin "*" + + + +# Pragmatic Accept: text/markdown (static-first, not strict RFC). +# Subdir rules shadow the domain-root rewrite block, so both live here. + +RewriteEngine On + +RewriteCond %{REQUEST_URI} \.(css|js|mjs|map|png|jpe?g|webp|gif|svg|avif|ico|woff2?|ttf|otf|eot|xml|txt|json|pdf|mp4|webm|mp3|wav|ogg|zip)$ [NC] +RewriteRule ^ - [L] +RewriteCond %{REQUEST_URI} \.mdx?$ [NC] +RewriteRule ^ - [L] + +# /codemap/ -> /codemap/index.md +RewriteCond %{HTTP:Accept} text/markdown [NC] +RewriteCond %{HTTP:Accept} !text/markdown\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC] +RewriteRule ^$ /codemap/index.md [L,T=text/markdown] + +# /codemap/ -> twin .md +RewriteCond %{HTTP:Accept} text/markdown [NC] +RewriteCond %{HTTP:Accept} !text/markdown\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC] +RewriteCond %{REQUEST_FILENAME} !\.md$ [NC] +RewriteCond %{DOCUMENT_ROOT}/codemap/$1.md -f +RewriteRule ^(.+?)/?$ /codemap/$1.md [L,T=text/markdown] +