-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create 404.html with automatic redirection
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!doctype html> | ||
<html lang="en-US"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<noscript> | ||
<meta | ||
http-equiv="refresh" | ||
content="0; url=https://github.com/express-rate-limit/express-rate-limit" | ||
/> | ||
</noscript> | ||
<script type="text/javascript"> | ||
// default redirection target | ||
let target = 'https://github.com/express-rate-limit/express-rate-limit' | ||
// strip the leading and trailing slashes and lowercase | ||
let path = location.pathname.substr(1).toLowerCase(); | ||
if (path.endsWith('/')) { | ||
path = path.substring(0, path.length-1) | ||
} | ||
if (path.startsWith('err_erl_') || path.startsWith('wrn_erl_')) { | ||
target += '/wiki/Error-Codes#' + path; | ||
} | ||
document.addEventListener("DOMContentLoaded", (event) => { | ||
const link = document.getElementById('link'); | ||
if (link) link.href = target; | ||
}); | ||
window.location.href = target; | ||
</script> | ||
<title>Page Redirection</title> | ||
</head> | ||
<body> | ||
If you are not redirected automatically, follow | ||
<a id="link" | ||
href="https://github.com/express-rate-limit/express-rate-limit" | ||
> | ||
this link | ||
</a> | ||
to the Express Rate Limit page. | ||
</body> | ||
</html> |