Skip to content

Commit 0eac611

Browse files
committed
Create 404.html with automatic redirection
1 parent dd73fcd commit 0eac611

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

404.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<noscript>
6+
<meta
7+
http-equiv="refresh"
8+
content="0; url=https://github.com/express-rate-limit/express-rate-limit"
9+
/>
10+
</noscript>
11+
<script type="text/javascript">
12+
// default redirection target
13+
let target = 'https://github.com/express-rate-limit/express-rate-limit'
14+
// strip the leading and trailing slashes and lowercase
15+
let path = location.pathname.substr(1).toLowerCase();
16+
if (path.endsWith('/')) {
17+
path = path.substring(0, path.length-1)
18+
}
19+
if (path.startsWith('err_erl_') || path.startsWith('wrn_erl_')) {
20+
target += '/wiki/Error-Codes#' + path;
21+
}
22+
document.addEventListener("DOMContentLoaded", (event) => {
23+
const link = document.getElementById('link');
24+
if (link) link.href = target;
25+
});
26+
window.location.href = target;
27+
</script>
28+
<title>Page Redirection</title>
29+
</head>
30+
<body>
31+
If you are not redirected automatically, follow
32+
<a
33+
id="link"
34+
href="https://github.com/express-rate-limit/express-rate-limit"
35+
>
36+
this link
37+
</a>
38+
to the Express Rate Limit page.
39+
</body>
40+
</html>

0 commit comments

Comments
 (0)