Page 1 of 1

Question on Redirect!!!

Posted: Thu Oct 30, 2003 7:25 pm
by jakelee
I have two domains pointing to the same ISP hosted web site.
Both sites will load index.php. I am wondering if I can redirect requests for http://www.domain2.com (host in header) to a subfolder (/domain2/).

Please show some code snippets to do this if possible...
Thanks a lot.

Jake

Posted: Thu Oct 30, 2003 10:02 pm
by Vicious
Thatll Auto-Redirect to what u have in that script


<?PHP
header("location: http://www.domain2.com");

?>

Posted: Thu Oct 30, 2003 10:24 pm
by phice
If you have a decent web host, you can add more domains to the same account and have different folders for each one. You can sign up at AkiraWeb.com (my current hosts), which supports multiple domain hosting on one account.

Posted: Fri Oct 31, 2003 6:29 pm
by jakelee
phice wrote:If you have a decent web host, you can add more domains to the same account and have different folders for each one. You can sign up at AkiraWeb.com (my current hosts), which supports multiple domain hosting on one account.
my current host charges for this added domain feature...therefore for all requests for domain2.com, I need to redirect to a subfolder via this approach.

Posted: Fri Oct 31, 2003 6:47 pm
by jakelee
Vicious wrote:Thatll Auto-Redirect to what u have in that script

<?PHP
header("location: http://www.domain2.com");
?>
I know how to redirect but this redirect is based on the value of host in the request header.

How do I check headers[host] to see if its value is "www.domain2.com", then it is true, I can do the redirect to a subfolder.
<?PHP
header("location: /domain2/");
?>

Thanks,

J-