Skip to content

Commit 4ccba3b

Browse files
committed
Dynamic 404 to redirect old pages
1 parent c70eaf9 commit 4ccba3b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

404.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>404 Not Found</title>
5+
<script>
6+
var oldHome = "http://www.macruby.org";
7+
8+
function redirectOr404(req, status) {
9+
if (status == 200) {
10+
document.location = oldHome + document.location.pathname;
11+
}
12+
else {
13+
document.write("<h1>Not Found</h1><p>The requested URL " + document.location.pathname + " was not found on this server.</p>");
14+
}
15+
}
16+
17+
var client = new XMLHttpRequest();
18+
client.onreadystatechange = function () {
19+
if (this.readyState == 4)
20+
redirectOr404(this, this.status);
21+
}
22+
client.open("HEAD", oldHome + document.location.pathname);
23+
client.send();
24+
</script>
25+
</head>
26+
<body></body>
27+
</html>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy