if (window.location.href.charAt(window.location.href.length - 1) !== "/") { window.history.replaceState({}, document.title, window.location.href + "/"); } if(window.location.href.includes("?") && !window.location.href.includes("/?")) { const newUrl = window.location.href.replace("?", "/?"); window.history.replaceState({}, document.title, newUrl); }