-
Notifications
You must be signed in to change notification settings - Fork 0
/
404.html
34 lines (32 loc) · 1.12 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- TODO: Replace title with your website's name-->
<title>Junping Luo</title>
<script type="text/javascript">
// Dictionary that has all of your redirect rules
// You can add additional redirects if you'd like
// e.g. /resume -> /resume.pdf
const redirects = {
"resume": "resume.pdf"
}
// window.location.pathname -> Get the path -> /resume
// .substring(1) -> remove the first character -> resume
// .toLowerCase() -> make sure the path name is all lowercase
const path = window.location.pathname.substring(1).toLowerCase();
const redirect = redirects[path];
if (redirect) {
// Redirect to the desired location
window.location.replace(redirect);
} else {
// If the path doesn't exist, you can redirect to your main page
// or you can remove this line of code if you just want to show the 404 page.
window.location.replace("index.html"); // TODO: add your website
}
</script>
</head>
<body>
<h1>404 Not Found</h1>
</body>
</html>