Dns 将一个域重定向到另一个域子目录

Dns 将一个域重定向到另一个域子目录,dns,subdomain,url-redirection,Dns,Subdomain,Url Redirection,我一直在谷歌上四处寻找,但运气不好 我试图完成什么:我试图获取我的domain1.com并将其重定向到domain2.com/foo.php这可能吗?将此php代码添加到index.php页面,它将立即发送重定向 <?php header("location: http://domain2.com/foo.php"); ?>

我一直在谷歌上四处寻找,但运气不好


我试图完成什么:我试图获取我的domain1.com并将其重定向到domain2.com/foo.php这可能吗?

将此php代码添加到index.php页面,它将立即发送重定向

<?php header("location: http://domain2.com/foo.php"); ?>