diff --git a/.changeset/upset-parents-sniff.md b/.changeset/upset-parents-sniff.md new file mode 100644 index 000000000000..4e35d486d767 --- /dev/null +++ b/.changeset/upset-parents-sniff.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': minor +--- + +feat: allow hosting hash-based apps from non-index.html files diff --git a/packages/kit/src/runtime/client/utils.js b/packages/kit/src/runtime/client/utils.js index c233ef9ae52f..b373a2e71d8a 100644 --- a/packages/kit/src/runtime/client/utils.js +++ b/packages/kit/src/runtime/client/utils.js @@ -317,12 +317,11 @@ export function is_external_url(url, base, hash_routing) { } if (hash_routing) { - if (url.pathname === base + '/' || url.pathname === base + '/index.html') { - return false; - } - - // be lenient if serving from filesystem - if (url.protocol === 'file:' && url.pathname.replace(/\/[^/]+\.html?$/, '') === base) { + if ( + url.pathname === base + '/' || + url.pathname === base + '/index.html' || + url.pathname.replace(/\/[^/]+\.html?$/, '') === base + ) { return false; }