File tree Expand file tree Collapse file tree 1 file changed +3
-11
lines changed
Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Original file line number Diff line number Diff line change 1616 var query = window . location . search ;
1717 var fragment = window . location . hash ;
1818
19- // If the path is not / and doesn't end with .html, redirect to /index.html
20- // This is a more robust check to ensure we only redirect when necessary
21- if ( path !== '/' && ! path . endsWith ( '.html' ) && ! path . endsWith ( '/' ) ) {
22- // Store the original path in sessionStorage
23- sessionStorage . setItem ( 'redirectPath' , path + query + fragment ) ;
24- // Redirect to index.html
19+ // Only redirect if not already on index.html and not a direct file request
20+ if ( path !== '/index.html' && ! path . endsWith ( '.html' ) ) {
21+ window . history . replaceState ( null , null , path + query + fragment ) ;
2522 window . location . replace ( '/index.html' ) ;
26- } else if ( sessionStorage . getItem ( 'redirectPath' ) ) {
27- // If we are on index.html and there's a stored redirectPath,
28- // then replace the current history state with the stored path
29- window . history . replaceState ( null , null , sessionStorage . getItem ( 'redirectPath' ) ) ;
30- sessionStorage . removeItem ( 'redirectPath' ) ;
3123 }
3224 } ) ( ) ;
3325 </ script >
You can’t perform that action at this time.
0 commit comments