diff --git a/public/404.html b/public/404.html
index 4974167..769402f 100644
--- a/public/404.html
+++ b/public/404.html
@@ -21,6 +21,13 @@
basePath = '/copilot-videos/#' + pathname.replace('copilot-videos', '');
}
+ // get the search up to the first slash or question mark
+ searchBeginning = search.split(/[/?]/)[0];
+ if (basePath.includes(searchBeginning)) {
+ // Remove the search from the basePath
+ search = search.replace(searchBeginning, '');
+ }
+
// If there are double slashes anywhere in the url, remove them
if (basePath.includes('//')) {
basePath = basePath.replace('//', '/');