Skip to content

Commit 5d29ef1

Browse files
committed
Updates
1 parent 1f3df44 commit 5d29ef1

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

404.html

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,13 @@
1212
// to the new URL with the query string and hash fragment, but no
1313
// path, to load the single page app's index.html root.
1414
(function(){
15-
var redirect = sessionStorage.getItem('redirect');
16-
if (redirect) {
17-
sessionStorage.removeItem('redirect');
18-
window.location.replace(redirect);
19-
} else {
20-
var path = window.location.pathname;
21-
var query = window.location.search;
22-
var fragment = window.location.hash;
23-
var newUrl = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/?' +
24-
(path.startsWith('/') ? path.substring(1) : path) + query + fragment;
25-
sessionStorage.setItem('redirect', newUrl);
26-
window.location.replace(newUrl);
15+
var path = window.location.pathname;
16+
var query = window.location.search;
17+
var fragment = window.location.hash;
18+
// If the path is not / and doesn't end with .html, redirect to /index.html
19+
if (path !== '/' && !path.endsWith('.html')) {
20+
window.history.replaceState(null, null, path + query + fragment);
21+
window.location.replace('/index.html');
2722
}
2823
})();
2924
</script>

0 commit comments

Comments
 (0)