-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path404.html
More file actions
35 lines (31 loc) · 1.04 KB
/
404.html
File metadata and controls
35 lines (31 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Redirecting…</title>
</head>
<body>
<script>
// GitHub Pages serves 404.html for unknown paths (e.g. /projects).
// Redirect to /?/projects so index.html can restore the URL and the
// Vue Router (history mode) app can render the correct route.
// Based on the widely-used SPA GitHub Pages pattern.
(function (location) {
const segmentCount = 0
const pathname = location.pathname
.split('/')
.slice(0, 1 + segmentCount)
.join('/')
const redirectPath = location.pathname
.split('/')
.slice(1 + segmentCount)
.join('/')
const search = location.search
? '&' + location.search.slice(1).replace(/&/g, '~and~')
: ''
location.replace(pathname + '/?/' + redirectPath + search + location.hash)
})(window.location)
</script>
</body>
</html>