const redirects = { "index.html": { @events-redirects@ } }; let segments = document.location.pathname.split('/'); // Das erste Element ist immer `''` segments.splice(0, 1); let file = segments.pop(); if (file === '') { file = "index.html"; } segments.push(file); const path = segments.join('/'); const anchor = document.location.hash.substring(1); const redirect = redirects[path]; if (redirect) { const target = redirect[anchor]; if (target) { document.location.href = target; } }