Several Domains Share the Same Site Space

IF you have several domains, and want to use them, but you are afraid of the cost of the site space, the following code can help you solve the problem. (the code is written in PHP, and the default main index page is index.php, different site is set in different directory).


<?php $domain_net1="yourdomainname1.com";
$domain_net2="yourdomainname2.com";
// directory set for yourdomainname1.com
$dot_net_url1="site1/";
$dot_net_url2="site2/";
$dot_net_url3="site3/";
if(($HTTP_HOST=="$domain_net1")
  or($HTTP_HOST=="www.$domain_net1"))
{
Header("Location: $dot_net_url1");
}
else if(($HTTP_HOST=="$domain_net2")
       or($HTTP_HOST=="www.$domain_net2"))
{
Header("Location: $dot_net_url2");
}
else
{
Header("Location: $dot_net_url3");
}
?>
   Send article as PDF   

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.