Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions apps/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@
src="https://analytics.thp.box/script.js"
data-website-id="13760d0b-e30d-43c2-9026-1920a86720c8">
</script>

<script>
// Restore clean URL when coming from 404 fallback (/?/route → /route)
(function(l) {
if (l.search && l.search.startsWith('?/')) {
var decoded = l.search.slice(2)
.split('&')
.map(function(s){ return s.replace(/~and~/g, '&') })
.join('?');
window.history.replaceState(null, null, '/' + decoded + l.hash);
}
})(window.location);
</script>
</head>
<body>
<div id="root"></div>
Expand Down
22 changes: 22 additions & 0 deletions apps/web/public/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Redirecting…</title>
<!-- SPA fallback for GitHub Pages using a custom domain at root -->
<script>
// Credits: https://github.com/rafgraph/spa-github-pages
(function() {
var l = window.location;
var segmentCount = 0; // custom domain served at root → keep 0
var redirect = l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
l.pathname.split('/').slice(0, 1 + segmentCount).join('/') + '/?/' +
l.pathname.slice(1).split('/').slice(segmentCount).join('/').replace(/&/g, '~and~') +
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
l.hash;
l.replace(redirect);
})();
</script>
</head>
<body></body>
</html>
Loading