diff --git a/layouts/404.html b/layouts/404.html
index d3637af38e..5b18c48491 100644
--- a/layouts/404.html
+++ b/layouts/404.html
@@ -1,4 +1,5 @@
{{ define "main" }}
+{{ partial "handle-version-switch-404.html" . }}
Perhaps you were looking for:
diff --git a/layouts/partials/handle-version-switch-404.html b/layouts/partials/handle-version-switch-404.html
new file mode 100644
index 0000000000..d2130bf49f
--- /dev/null
+++ b/layouts/partials/handle-version-switch-404.html
@@ -0,0 +1,11 @@
+{{/*
+If a 404 occurs and the referrer is a different version of the Kubernetes documentation,
+don't show the regular 404 error page, but instead redirect to the site root
+*/}}
+
diff --git a/layouts/partials/navbar-version-selector.html b/layouts/partials/navbar-version-selector.html
index 09e872053f..ce38b96d9e 100644
--- a/layouts/partials/navbar-version-selector.html
+++ b/layouts/partials/navbar-version-selector.html
@@ -2,7 +2,8 @@
{{ T "version_menu" }}
\ No newline at end of file