Multiple domain redirect
Posted: Wed Nov 29, 2006 9:39 am
Hi,
I've a domain working on Apache/2.0.59 (Win32) mod_jk/1.2.18 PHP/4.4.4 setup. It works fine, but I recently configured another domain on the same server. Nameservers and everything is fine but the new domain points to the location of old domain.
Is there any way, using PHP, to redirect both domains to different locations?
For a single domain redirect, I used this so far:
I tried this for multiple domain redirect, but it doesn't work:
Any help greatly appreciated.
Thanks.
I've a domain working on Apache/2.0.59 (Win32) mod_jk/1.2.18 PHP/4.4.4 setup. It works fine, but I recently configured another domain on the same server. Nameservers and everything is fine but the new domain points to the location of old domain.
Is there any way, using PHP, to redirect both domains to different locations?
For a single domain redirect, I used this so far:
Code: Select all
<?php
header("Location: v/index.jsp"); /* Redirect browser */
/* Make sure that code below does not get executed when we redirect. */
exit;
?>I tried this for multiple domain redirect, but it doesn't work:
Code: Select all
<?php
header("Location: http://domain1.com" . $_SERVER['HTTP_HOST']
. dirname($_SERVER['PHP_SELF'])
. "/dir/file.ext" . $relative_url);
header("Location: http://domain2.com" . $_SERVER['HTTP_HOST']
. dirname($_SERVER['PHP_SELF'])
. "/dir/file.ext" . $relative_url);
?>Any help greatly appreciated.
Thanks.