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

wanggenhua pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler-website.git


The following commit(s) were added to refs/heads/master by this push:
     new e4b9715a67 [Improve] Added redirects on the 404 page. (#861)
e4b9715a67 is described below

commit e4b9715a67d104b11f0857555ffeca391df0e55e
Author: Amy0104 <[email protected]>
AuthorDate: Fri Dec 16 11:25:35 2022 +0800

    [Improve] Added redirects on the 404 page. (#861)
---
 public/404.html | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/public/404.html b/public/404.html
index c76667b444..ad07bf5c2a 100644
--- a/public/404.html
+++ b/public/404.html
@@ -25,7 +25,38 @@
   </head>
   <body>
     <script>
-      window.location.href = "/";
+      (() => {
+        const href = window.location.href;
+        const lang = href.includes("zh-cn") ? "zh-cn" : "en-us";
+        if (href.includes("download.html")) {
+          window.location.replace(`/#/${lang}/download`);
+          return;
+        }
+        if (href.includes("blog")) {
+          const matchedName = /blog\/(.*?).html/.exec(href);
+          window.location.replace(
+            `/#/${lang}/blog${matchedName ? "/" + matchedName[1] : ""}`
+          );
+          return;
+        }
+        if (href.includes("docs")) {
+          const url = href
+            .replace(/.html/, "")
+            .replace(/\/user_doc/, "")
+            .replace(lang, `#/${lang}`);
+          window.location.replace(url);
+          return;
+        }
+        if (href.includes("community.html")) {
+          window.location.replace(`/#/${lang}/community`);
+          return;
+        }
+        if (href.includes("user/index.html")) {
+          window.location.replace(`/#/${lang}/use_case`);
+          return;
+        }
+        window.location.replace(`/#/${lang}`);
+      })();
     </script>
     <!--
       This HTML file is a template.

Reply via email to