-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path404.html
More file actions
31 lines (31 loc) · 1.37 KB
/
404.html
File metadata and controls
31 lines (31 loc) · 1.37 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Single Page Apps for GitHub Pages</title>
<script type="text/javascript">
/////////////////////////////////////////////////////////////////////////
// Single Page Apps for GitHub Pages
// https://github.com/rafrex/spa-github-pages
// ----------------------------------------------------------------------
// This script takes the current url and converts the path and query
// string into just a query string, and then redirects the browser
// to the new url with only a query string and hash fragment,
// e.g. http://www.foo.tld/one/two?a=b&c=d#qwe, becomes
// http://www.foo.tld/?redirect=true&pathname=%2Fone%2Ftwo&query=a=b%26c=d#qwe
// Note: this 404.html file must be at least 512 bytes for it to work
// with Internet Explorer (it is currently > 512 bytes)
/////////////////////////////////////////////////////////////////////////
var l = window.location;
l.replace(
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
'/?' + 'redirect=true' +
(l.pathname ? '&pathname=' + l.pathname.replace(/\//g, '%2F').replace(/&/g, '%26') : '') +
(l.search ? '&query=' + l.search.replace(/\//g, '%2F').replace(/&/g, '%26') : '') +
l.hash
);
</script>
</head>
<body>
</body>
</html>