-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path404.html
More file actions
33 lines (31 loc) · 1.07 KB
/
404.html
File metadata and controls
33 lines (31 loc) · 1.07 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Juan Rodriguez</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": "Juan_Rodriguez_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("https://1jc1.github.io/");
}
</script>
</head>
<body>
<h1>404 Not Found</h1>
</body>
</html>