-
Notifications
You must be signed in to change notification settings - Fork 11
/
404.html
61 lines (60 loc) · 1.47 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
permalink: /404.html
title: redirecting...
---
<head>
<script>
var oldPath =
document.baseURI != undefined ? document.baseURI : document.documentURI;
console.log("coming from: " + oldPath);
if (oldPath == undefined) {
oldPath = "";
}
var splittedPath = oldPath.split("/");
var startingPosition =
splittedPath.indexOf("polinetwork.org") != -1
? splittedPath.indexOf("polinetwork.org")
: splittedPath.indexOf("127.0.0.1:4000");
var intrestingPath = "";
console.log(splittedPath);
console.log(startingPosition);
for (
let i = startingPosition != null ? startingPosition + 1 : 3;
i < splittedPath.length;
i++
) {
intrestingPath += splittedPath[i] + "/";
}
if (intrestingPath.length > 0 && intrestingPath.slice(-1) == "/") {
intrestingPath = intrestingPath.slice(0, -1);
}
console.log(intrestingPath);
intrestingPath = intrestingPath.trim();
var userLang = navigator.language || navigator.userLanguage;
if (userLang.includes("it")) {
if (
!(
intrestingPath == "" ||
splittedPath[3] == "it" ||
splittedPath[3] == "en"
)
) {
window.location.replace("/it/" + intrestingPath);
} else {
window.location.replace("/it/404.html");
}
} else {
if (
!(
intrestingPath == "" ||
splittedPath[3] == "it" ||
splittedPath[3] == "en"
)
) {
window.location.replace("/en/" + intrestingPath);
} else {
window.location.replace("/en/404.html");
}
}
</script>
</head>