New URL redirection

This commit is contained in:
2025-11-30 22:30:46 +08:00
parent 83aaf333d6
commit 48fc7287a6
9 changed files with 102 additions and 153 deletions

View File

@@ -4,22 +4,26 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<title></title>
<link rel="preload" href="/js/404.js" as="script">
<link rel="preload" href="/js/layout.js" as="script">
<link rel="preload" href="/js/i18n.js" as="script">
<link rel="preload" href="/css/layout.css" as="style" onload="this.rel='stylesheet'">
<link rel="preload" href="/css/404.css" as="style" onload="this.rel='stylesheet'">
<link rel="preload" href="/font-awesome/css/all.min.css" as="style" onload="this.rel='stylesheet'">
<link rel="preload" href="/img/background_v0.1.x.webp" as="image">
<link rel="preload" href="/font-awesome/webfonts/fa-brands-400.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/font-awesome/webfonts/fa-regular-400.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/font-awesome/webfonts/fa-solid-900.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/font-awesome/webfonts/fa-v4compatibility.woff2" as="font" type="font/woff2" crossorigin>
</head>
<body>
<script src="/js/404.js"></script>
<script>
(function () {
const path = window.location.pathname;
const isDirect404Access = path.includes('404.html');
if (isDirect404Access) {
window.location.replace('/');
} else {
const newPath = '/#' + path + window.location.search;
window.location.replace(newPath);
}
})();
</script>
</body>
</html>