Something like this:
var url_string = window.location.href
var url = new URL(url_string);
var id = url.searchParams.get("id");
window.location.replace("www.redirectaddress.com/p?id="+id); //redirect
2
solved How to detect and replace values/parameters in URL on redirection [closed]