I have a code to redirect page in old website to same path in new website
but I need to redirect page to same path for multiple websites randomly
website1.com , website2.com and website3.com
window.location.href = "http://" + "website1.com/" + window.location.pathname
>Solution :
Like this, if you insist on doing on the client
const sites = ["site1.com","site2.com","site3.com"];
let site = sites[Math.floor(Math.random()*sites.length)];
let url = `https://${site}${window.location.pathname}`;
console.log(url)
//window.location.href = url;