diff --git a/404.md b/404.md index bf053c1e3b..e644c19ed2 100644 --- a/404.md +++ b/404.md @@ -3,66 +3,7 @@ layout: docwithnav title: 404 Error! permalink: /404.html --- - + + Sorry, this page was not found. :( diff --git a/js/redirects.js b/js/redirects.js new file mode 100644 index 0000000000..dc3cbb56ed --- /dev/null +++ b/js/redirects.js @@ -0,0 +1,60 @@ +$( document ).ready(function() { + var oldURLs=["/README.md","/README.html",".html",".md","/v1.1/","/v1.0/"]; + var fwdDirs=["examples/","cluster/","docs/devel","docs/design"]; + var doRedirect = false; + var notHere = false; + var forwardingURL=window.location.href; + + var redirects = [{ + "from": "third_party/swagger-ui", + "to": "http://kubernetes.io/kubernetes/third_party/swagger-ui/" + }, + { + "from": "resource-quota", + "to": "http://kubernetes.io/docs/admin/resourcequota/" + }, + { + "from": "horizontal-pod-autoscaler", + "to": "http://kubernetes.io/docs/user-guide/horizontal-pod-autoscaling/" + }, + { + "from": "docs/roadmap", + "to": "https://github.com/kubernetes/kubernetes/milestones/" + }, + { + "from": "api-ref/", + "to": "https://github.com/kubernetes/kubernetes/milestones/" + }, + { + "from": "docs/user-guide/overview", + "to": "http://kubernetes.io/docs/whatisk8s/" + }]; + + for (i=0;i -1){ + notHere = true; + window.location.replace(redirects[i].to); + } + } + + for (i=0;i -1){ + var urlPieces = forwardingURL.split(fwdDirs[i]); + var newURL = "https://github.com/kubernetes/kubernetes/tree/{{page.githubbranch}}/" + fwdDirs[i] + urlPieces[1]; + notHere = true; + window.location.replace(newURL); + } + } + if (!notHere) { + for (i=0;i -1 && + forwardingURL.indexOf("404.html") < 0){ + doRedirect=true; + forwardingURL=forwardingURL.replace(oldURLs[i],"/"); + } + } + if (doRedirect){ + window.location.replace(forwardingURL); + }; + } +});