layouts/partials/handle-version-switch-404.html (11 lines of code) (raw):

{{/* If a 404 occurs and the referrer is a different version of the Dubbo documentation, don't show the regular 404 error page, but instead redirect to the site root */}} <script type="text/javascript"> var sameBaseUrlRegExp = new RegExp("^" + location.protocol + "//" + location.host.replace(".", "\\.") + "/.*", "i"); var DubboDocumentationUrlRegExp = new RegExp("^https?://(.+\\.)?dubbo.apache.org/.*", "i"); if (!sameBaseUrlRegExp.test(document.referrer) && DubboDocumentationUrlRegExp.test(document.referrer)) { location.replace("/"); } </script>