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

tison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git


The following commit(s) were added to refs/heads/main by this push:
     new 6ad6454c904 Use server side redirection: BUILD_ALL_VERSION=1 (#382)
6ad6454c904 is described below

commit 6ad6454c904f845bd94684cc4778430f5e267ed5
Author: tison <[email protected]>
AuthorDate: Fri Jan 13 15:41:52 2023 +0800

    Use server side redirection: BUILD_ALL_VERSION=1 (#382)
    
    Signed-off-by: tison <[email protected]>
---
 docusaurus.config.js | 18 +-----------------
 static/.htaccess     | 19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/docusaurus.config.js b/docusaurus.config.js
index fb1c24d2147..67a6eb0f7a3 100644
--- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -161,8 +161,7 @@ module.exports = {
                     position: "right",
                     items: [
                         {
-                            type: "doc",
-                            docId: "concepts-overview",
+                            to: `/docs/${versions[0]}/concepts-overview/`,
                             label: "Pulsar Concepts",
                         },
                         {
@@ -352,21 +351,6 @@ module.exports = {
         ],
     ],
     plugins: [
-        [
-            '@docusaurus/plugin-client-redirects',
-            /** @type {import('@docusaurus/plugin-client-redirects').Options} 
*/
-            {
-                createRedirects(existingPath) {
-                    const latestVersion = versions[0];
-                    if (existingPath.includes(`/docs/${latestVersion}`)) {
-                        return [
-                            existingPath.replace(`/docs/${latestVersion}`, 
'/docs/'),
-                        ];
-                    }
-                    return undefined;
-                },
-            },
-        ],
         "./postcss-tailwind-loader",
         [
             'content-docs',
diff --git a/static/.htaccess b/static/.htaccess
index 4bf2b3bbdd7..7d831ca7447 100755
--- a/static/.htaccess
+++ b/static/.htaccess
@@ -4,7 +4,8 @@ RewriteRule "^en/(.+)$" "/$1" [R=301,DPI,L]
 RewriteRule "^docs/en/(.+)$" "/docs/$1" [R=301,DPI,L]
 RewriteRule "^docs/(zh-CN|zh-TW|ja|ko|fr)/(.+)$" "/$1/docs/$2" [R=301,DPI,L]
 RewriteRule "^(zh-CN|zh-TW|ja|ko|fr)/docs/(.+)$" "/docs/$2" [R=301,DPI,L]
-RewriteRule "^docs$" "/docs/" [R=301,DPI,L]
+
+RewriteRule "^docs/?$" "/docs/2.11.x" [R=301,DPI,L]
 RewriteRule "^docs/(.+)-incubating/(.+)$" 
"https://pulsar.staged.apache.org/docs/$1-incubating/$2"; [R=301,DPI,L]
 
 RewriteRule "^pulsar-manager-release-notes(/)?$" "/release-notes" [R=301,DPI,L]
@@ -15,7 +16,15 @@ RewriteRule "^contributing(/)?$" "/contribute/" [R=301,DPI,L]
 RewriteCond %{REQUEST_FILENAME}\/index\.html -f
 RewriteRule ^ - [L]
 
-RewriteRule "^docs/(.+/)?develop-binary-protocol(/)?$" 
"/docs/$1developing-binary-protocol" [R=301,DPI,L]
-RewriteRule "^docs/(.+/)?administration-dashboard(/)?$" 
"/docs/$1administration-pulsar-manager" [R=301,DPI,L]
-RewriteRule "^docs/(.+/)?security-tls-keystore(/)?$" 
"/docs/$1security-tls-authentication" [R=301,DPI,L]
-RewriteRule "^docs/(.+/)?security-policy-and-supported-versions(/)?$" 
"/contribute/version-policy/" [R=301,DPI,L]
+RewriteCond expr "%{REQUEST_URI} !~ m|^/docs/next|"
+RewriteCond expr "%{REQUEST_URI} !~ m|^/docs/next\/.*|"
+RewriteCond expr "%{REQUEST_URI} !~ m|^/docs/\d+\.\d+\.\d+|"
+RewriteCond expr "%{REQUEST_URI} !~ m|^/docs/\d+\.\d+\.\d+/.*|"
+RewriteCond expr "%{REQUEST_URI} !~ m|^/docs/\d+\.\d+\.x|"
+RewriteCond expr "%{REQUEST_URI} !~ m|^/docs/\d+\.\d+\.x/.*|"
+RewriteRule "^docs/(.*)$" "/docs/2.11.x/$1" [R=301,DPI,L]
+
+RewriteRule "^docs/(.+/)?develop-binary-protocol/?$" 
"/docs/$1developing-binary-protocol" [R=301,DPI,L]
+RewriteRule "^docs/(.+/)?administration-dashboard/?$" 
"/docs/$1administration-pulsar-manager" [R=301,DPI,L]
+RewriteRule "^docs/(.+/)?security-tls-keystore/?$" 
"/docs/$1security-tls-authentication" [R=301,DPI,L]
+RewriteRule "^docs/(.+/)?security-policy-and-supported-versions/?$" 
"/contribute/version-policy" [R=301,DPI,L]

Reply via email to