diff --git a/src/404.md b/src/404.md
new file mode 100644
index 0000000..81e2d94
--- /dev/null
+++ b/src/404.md
@@ -0,0 +1,9 @@
+### Document not found(404)
+
+**文档未找到(404)**
+
+
+抱歉,此 URL 无效。请使用导航栏或搜索继续。将在 n 秒后重定向到主页......
+
+
+This URL is invalid, sorry. Please use the navigation bar or search to continue. It will be redirected to home in n seconds...
diff --git a/theme/pagetoc.js b/theme/pagetoc.js
index 49e0bf9..2e79f03 100644
--- a/theme/pagetoc.js
+++ b/theme/pagetoc.js
@@ -47,3 +47,21 @@ window.addEventListener('load', function() {
// Handle active elements on scroll
window.addEventListener("scroll", updateFunction);
+
+if(document.querySelector("#document-not-found404")) {
+ let timeLeft = 10;
+
+ var timerId = setInterval(() => {
+ if(timeLeft == -1) {
+ clearTimeout(timerId);
+ let siteRoot = window.location.origin;
+ window.location.replace(siteRoot);
+ } else {
+ let secCounts = document.querySelectorAll(".sec-count")
+ secCounts.forEach(count => {
+ count.innerHTML = timeLeft;
+ });
+ timeLeft--;
+ }
+ }, 1000);
+}