Skip to content

Commit 6383404

Browse files
committed
fix rerooting
1 parent dafa585 commit 6383404

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@
3939
<!-- Google tag (gtag.js) -->
4040
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ZEWB4BYENK"></script>
4141
<script>
42+
(function (l) {
43+
if (l.search[1] === "/") {
44+
const decoded = l.search
45+
.slice(1)
46+
.split("&")
47+
.map((s) => s.replace(/~and~/g, "&"))
48+
.join("?");
49+
window.history.replaceState(null, null, decoded + l.hash);
50+
}
51+
})(window.location);
52+
4253
window.dataLayer = window.dataLayer || [];
4354
function gtag(){dataLayer.push(arguments);}
4455
gtag('js', new Date());

public/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 lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Redirecting…</title>
6+
<meta name="robots" content="noindex">
7+
<script>
8+
(function () {
9+
var l = window.location;
10+
var pathSegmentsToKeep = 1;
11+
var base = l.pathname.split("/").slice(0, 1 + pathSegmentsToKeep).join("/");
12+
var rest = l.pathname.slice(1).split("/").slice(pathSegmentsToKeep).join("/");
13+
var redirect =
14+
l.protocol +
15+
"//" +
16+
l.host +
17+
base +
18+
"/?/" +
19+
rest.replace(/&/g, "~and~") +
20+
(l.search ? l.search.replace(/&/g, "~and~") : "") +
21+
l.hash;
22+
l.replace(redirect);
23+
})();
24+
</script>
25+
</head>
26+
<body></body>
27+
</html>

0 commit comments

Comments
 (0)