var prothost = location.protocol + "//" + location.hostname; var hash = location.hash; var param = location.search; var pathName = location.pathname; param = param.replace(/\?/g, '&'); pathName = '?root=' + pathName.split('/').pop().replace(/\.html/g, ''); location.href = prothost + "/platinum/main.html" + pathName + param + hash;