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

liujun pushed a commit to branch mkdocs
in repository https://gitbox.apache.org/repos/asf/dubbo-website.git

commit 59585848c4df7fd7c986927d976380f62e817244
Author: ken.lj <[email protected]>
AuthorDate: Thu Oct 22 17:41:35 2020 +0800

    update href to redirect old urls
---
 404.html | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/404.html b/404.html
index 9dd7634..0f87552 100644
--- a/404.html
+++ b/404.html
@@ -20,14 +20,30 @@
   <a style="display: none" href="http://www.apache.org/security/";>Security</a>
   <!-- 添加Apache校验项结束 -->
   <script 
src="//cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
-       <script>
-    window.rootPath = '';
-    window.defaultLanguage = 'en-us';
-    var lang = Cookies.get('docsite_language');
-    if (!lang) {
-      lang = 'en-us';
+  <script>
+    var originalHref = window.location.href;
+    if (originalHref.indexOf("docs/user/") > -1) {
+      window.location.href = newHref("docs/user/", "docs/2.7/user/");
+    } else if (originalHref.indexOf("docs/dev/") > -1) {
+      window.location.href = newHref("docs/dev/", "docs/2.7/dev/");
+    } else if (originalHref.indexOf("docs/admin/") > -1) {
+      window.location.href = newHref("docs/admin/", "docs/2.7/admin/");
+    } else if (originalHref.indexOf("docs/source_code_guide/") > -1) {
+      window.location.href = newHref("docs/source_code_guide/", 
"docs/2.7/source_code_guide/");
+    } else if (originalHref.indexOf("docs/developers/") > -1) {
+      window.location.href = newHref("docs/developers/", "developers/");
+    } else if (originalHref.indexOf("blog/index.html") >-1) {
+      window.location.href = newHref("blog/index.html", "blog/2019-2020.html");
+    } else {
+      window.location.href = "http://dubbo.apache.org/en-us/";;
+    }
+
+    function newHref(path, newPath) {
+      var idx = originalHref.indexOf(path);
+      var part1 = originalHref.substring(0, idx);
+      var part2 = originalHref.substring(idx + path.length);
+      return part1 + newPath + part2;
     }
-    window.location = window.rootPath + '/' + lang;
   </script>
 </body>
 </html>
\ No newline at end of file

Reply via email to