Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Yusef Almamari committed Sep 25, 2024
1 parent fca7d1c commit b598adf
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,27 @@
* - For other cases, set `pathSegmentsToKeep` to 0.
*/

const pathSegmentsToKeep = 0; // Adjust as needed for your project configuration
var pathSegmentsToKeep = 0; // Adjust as needed for your project configuration

const l = window.location;
var { location } = window;

// Construct the new URL
const newUrl =
l.protocol +
var newUrl =
location.protocol +
"//" +
l.hostname +
(l.port ? ":" + l.port : "") +
l.pathname
location.hostname +
(location.port ? ":" + location.port : "") +
location.pathname
.split("/")
.slice(0, 1 + pathSegmentsToKeep)
.join("/") +
"/?/" +
l.pathname.slice(1).split("/").slice(pathSegmentsToKeep).join("/").replace(/&/g, "~and~") +
(l.search ? "&" + l.search.slice(1).replace(/&/g, "~and~") : "") +
l.hash;
location.pathname.slice(1).split("/").slice(pathSegmentsToKeep).join("/").replace(/&/g, "~and~") +
(location.search ? "&" + location.search.slice(1).replace(/&/g, "~and~") : "") +
location.hash;

// Redirect the browser to the new URL
l.replace(newUrl);
location.replace(newUrl);
</script>
</head>
<body></body>
Expand Down

0 comments on commit b598adf

Please sign in to comment.