-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path404.html
40 lines (40 loc) · 1.16 KB
/
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
33
34
35
36
37
38
39
40
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Redirecting...</title>
<link rel="stylesheet" type="text/css" href="/assets/style.css">
<link rel="icon" type="image/favicon" href="/assets/icons/favicon.ico">
</head>
<body>
<script>
var validPaths = ['/agenda', '/blogs'];
var redirectPath = window.location.pathname;
var isValidPath = false;
var i;
while (!isValidPath && redirectPath !== '/') {
if (redirectPath.endsWith('/')) {
redirectPath = redirectPath.substring(0, redirectPath.length - 1);
}
for (i = 0; i < validPaths.length; i++) {
if (redirectPath.endsWith(validPaths[i])) {
isValidPath = true;
break;
}
}
if (isValidPath) {
break;
}
redirectPath = redirectPath.substring(0, redirectPath.lastIndexOf('/')) + '/';
}
if (isValidPath) {
redirectPath += '/1';
} else {
redirectPath = '/';
}
if (!redirectPath.startsWith('/') || redirectPath.includes('..')) {
redirectPath = '/';
}
window.location.href = redirectPath;
</script>
</body>
</html>