Skip to content

Commit

Permalink
change 404 routing
Browse files Browse the repository at this point in the history
  • Loading branch information
martincham committed Oct 11, 2024
1 parent 1a7718d commit 8ed07d2
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions public/404.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>Redirecting...</title>
<script type="text/javascript">
// Script to redirect 404s to index.html
var redirectTo =
window.location.pathname.replace(/[^\/]+$/, "") + "index.html";
window.location.replace(redirectTo);
// Redirect to index.html and append the current path
const redirectUrl =
"/?redirect=" + encodeURIComponent(window.location.pathname);
window.location.replace(redirectUrl);
</script>
</head>
<body></body>
<body>
<h1>Redirecting...</h1>
<p>
If you are not redirected,
<a id="redirectLink" href="/">click here</a>.
</p>
</body>
</html>

0 comments on commit 8ed07d2

Please sign in to comment.