File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed
Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change 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 >
You can’t perform that action at this time.
0 commit comments