var url = 'https://site.com/path/file.php?id=1¶m='; alert([ url.replace(/^https?:\/\/[^\/]+(\/.*)/, '$1'), url.replace(/^https?:\/\/[^\/]+/, ''),// или так ]);
var url = new URL('https://site.com/path/file.php?id=1¶m='); alert(url.pathname + url.search);
var url = 'https://site.com/path/file.php?id=1¶m='; alert( url.substring( url.indexOf("/",8) ) );
var url = 'https://site.com/path/file.php?id=1¶m='; alert( url.replace(/^(https?:\/\/[^\/]+).*/, '$1') );