This is an automated email from the ASF dual-hosted git repository. hyunkun pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo-website.git
The following commit(s) were added to refs/heads/master by this push: new 9a4c137 enable 404 page (#725) 9a4c137 is described below commit 9a4c137b97a876bea10be1b068fe0e868ec41e37 Author: Huang YunKun <hty...@gmail.com> AuthorDate: Fri Jan 29 14:15:37 2021 +0800 enable 404 page (#725) --- .htaccess | 4 +++- layouts/404.html | 35 +---------------------------------- 2 files changed, 4 insertions(+), 35 deletions(-) diff --git a/.htaccess b/.htaccess index caf62ef..1cee504 100644 --- a/.htaccess +++ b/.htaccess @@ -2,4 +2,6 @@ RewriteEngine On RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] -</IfModule> \ No newline at end of file +</IfModule> + +ErrorDocument 404 /404.html \ No newline at end of file diff --git a/layouts/404.html b/layouts/404.html index 6473e73..f648800 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -2,40 +2,7 @@ <main id="main"> <div> <h1 id="title">Not found</h1> - <p>Oops! aaa This page doesn't exist. Try going back to our <a href="{{ "/" | relURL }}">home page</a>.</p> + <p>Oops! This page doesn't exist. Try going back to our <a href="{{ "/" | relURL }}">home page</a>.</p> </div> </main> - -<script> - var originalHref = window.location.href; - if (originalHref.indexOf("docs/user/") > -1) { - window.location.href = newHref("docs/user/", "docs/v2.7/user/"); - } else if (originalHref.indexOf("docs/dev/") > -1) { - window.location.href = newHref("docs/dev/", "docs/v2.7/dev/"); - } else if (originalHref.indexOf("docs/admin/") > -1) { - window.location.href = newHref("docs/admin/", "docs/v2.7/admin/"); - } else if (originalHref.indexOf("docs/source_code_guide/") > -1) { - window.location.href = newHref("docs/source_code_guide/", "docs/v2.7/dev/source/"); - } else if (originalHref.indexOf("docs/developers/") > -1) { - window.location.href = newHref("docs/developers/", "contribution-guidelines/"); - } else if (originalHref.indexOf("blog/index.html") >-1) { - window.location.href = newHref("blog/index.html", "blog/2018/08/07/dubbo-101/"); - } 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 = ""; - if (idx + path.length < originalHref.length -1) { - part2 = originalHref.substring(idx + path.length); - } - var newHref = part1 + newPath + part2; - if (newHref.endsWith('.html')) { - newHref = newHref.substr(0, newHref.length - 5) + "/"; - } - return newHref; - } -</script> {{ end }}