Question on Redirect!!!

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
jakelee
Forum Newbie
Posts: 3
Joined: Thu Oct 30, 2003 7:25 pm

Question on Redirect!!!

Post 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
Vicious
Forum Contributor
Posts: 105
Joined: Fri Jun 20, 2003 12:40 pm

Post by Vicious »

Thatll Auto-Redirect to what u have in that script


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

?>
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post 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.
Image Image
jakelee
Forum Newbie
Posts: 3
Joined: Thu Oct 30, 2003 7:25 pm

Post 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.
jakelee
Forum Newbie
Posts: 3
Joined: Thu Oct 30, 2003 7:25 pm

Post 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-
Post Reply