-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path404.html
32 lines (29 loc) · 878 Bytes
/
404.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirect</title>
<script>
(function() {
const segments = 1;
let location = window.location;
let url = location.origin;
for (let i = 0, n = 0; i < location.pathname.length; ++i) {
if (location.pathname[i] === '/' && ++n === segments + 1) {
url += location.pathname.slice(0, i + 1);
url += '?page=' + encodeURIComponent(location.pathname.slice(i + 1));
}
}
if (location.search) {
url += '&query=' + encodeURIComponent(location.search.slice(1));
}
if (location.hash) {
url += location.hash;
}
location.replace(url);
}())
</script>
</head>
<body>
</body>
</html>