html代码
<!DOCTYPE html>
<html>
<head>
<title>Redirecting...</title>
<script>
// 获取当前域名并替换
const currentDomain = window.location.hostname;
const newDomain = currentDomain.replace('qq.com', 'jd.com');
// 执行跳转
window.location.href = window.location.href.replace(currentDomain, newDomain);
</script>
<meta http-equiv="refresh" content="0; url=REPLACE_WITH_NEW_URL">
</head>
<body>
<p>Redirecting to corresponding JD.com domain...</p>
</body>
</html>
nginx
server {
server_name ~^(?<subdomain>.+)\.qq\.com$;
return 301 $subdomain.jd.com$request_uri;
}