This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch client-libraries-unversioned
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git


The following commit(s) were added to refs/heads/client-libraries-unversioned 
by this push:
     new c2e3c7c2d5a fix(client-libraries): cover remaining legacy URL shapes 
in redirects
c2e3c7c2d5a is described below

commit c2e3c7c2d5a9767f200c3fe2f9128eadeaf8962c
Author: Lari Hotari <[email protected]>
AuthorDate: Thu Apr 23 18:55:17 2026 +0300

    fix(client-libraries): cover remaining legacy URL shapes in redirects
    
    Two URL shapes weren't handled by the existing rules:
    - /docs/client-libraries-<slug> (bare, no version) — reachable via the 
legacy
      /docs/en/client-libraries-<slug> form that line 6 of .htaccess rewrites, 
and
      from any historical unversioned external link.
    - /docs/<version>/client-libraries/<slug> — the new canonical path 
accidentally
      prefixed with a version segment.
    
    Added matching rules to both static/.htaccess (production) and the
    clientLibrariesLegacyRedirects() entries in docusaurus.config.ts (dev mode 
and
    static hosts without mod_rewrite).
---
 docusaurus.config.ts | 13 +++++++++++++
 static/.htaccess     |  5 +++++
 2 files changed, 18 insertions(+)

diff --git a/docusaurus.config.ts b/docusaurus.config.ts
index e55bd7c850c..284a7100758 100644
--- a/docusaurus.config.ts
+++ b/docusaurus.config.ts
@@ -52,8 +52,21 @@ function clientLibrariesLegacyRedirects() {
         from: `/docs/${v}/client-libraries-${slug}`,
         to: `/docs/client-libraries/${slug}`,
       });
+      // Cover the case where the new canonical URL gets accidentally prefixed 
with a version.
+      entries.push({
+        from: `/docs/${v}/client-libraries/${slug}`,
+        to: `/docs/client-libraries/${slug}`,
+      });
     }
   }
+  // Bare /docs/client-libraries-<slug> (no version segment) — from very old 
external
+  // links, or from /docs/en/client-libraries-<slug> URLs that the .htaccess 
rewrites to this form.
+  for (const slug of slugs) {
+    entries.push({
+      from: `/docs/client-libraries-${slug}`,
+      to: `/docs/client-libraries/${slug}`,
+    });
+  }
   return entries;
 }
 
diff --git a/static/.htaccess b/static/.htaccess
index bd5a0dce7f8..25f6ff1cab7 100755
--- a/static/.htaccess
+++ b/static/.htaccess
@@ -25,6 +25,11 @@ RewriteRule "^docs/(.*)$" "/docs/4.2.x/$1" [R=301,DPI,L]
 # The version segment is captured and dropped; the client-libraries- slug 
prefix is also stripped.
 RewriteRule "^docs/(next|\d+\.\d+\.\d+|\d+\.\d+\.x)/client-libraries-(.+?)/?$" 
"/docs/client-libraries/$2" [R=301,DPI,L]
 RewriteRule "^docs/(next|\d+\.\d+\.\d+|\d+\.\d+\.x)/client-libraries/?$" 
"/docs/client-libraries/" [R=301,DPI,L]
+# New canonical path accidentally prefixed with a version segment — strip the 
version.
+RewriteRule "^docs/(next|\d+\.\d+\.\d+|\d+\.\d+\.x)/client-libraries/(.+?)/?$" 
"/docs/client-libraries/$2" [R=301,DPI,L]
+# Bare /docs/client-libraries-<slug> (no version) — from very old 
/docs/en/client-libraries-<slug>
+# URLs that line 6 rewrites to this form, and from any historical unversioned 
external links.
+RewriteRule "^docs/client-libraries-(.+?)/?$" "/docs/client-libraries/$1" 
[R=301,DPI,L]
 
 # /client-feature-matrix/ moved into the client-libraries plugin.
 RewriteRule "^client-feature-matrix/?$" 
"/docs/client-libraries/feature-matrix" [R=301,DPI,L]

Reply via email to