|
This is a really quick script for those who have one hosting with multiple domains pointing to it and would like to redirect the domains to different location instead of the relative path or home directory.
<?php
// ----- extremesh -----
// ----- ramesh.ws -----
// Parked Domain Redirect Script
// get's the entered domain name
$domain = $_SERVER['HTTP_HOST'];
// part which checks what url was typed by user and redirect
// to the domain accordingly.
// here you can set 2 domains, add by using elseif statement
// replace domain1, domain2 and etc as needed
if ($domain == "domain1.com" || $domain == "www.domain1.com") {
header("Location: http://urlfordomain1.com");
} elseif ($domain == "domain2.com" || $domain == "www.domain2.com") {
header("Location: http://urlfordomain2.com");
} else {
echo "The site you are looking for can't be found!";
}
?>
To add more domains just append the ELSEIF statement in the script. I am actually using this script with my hosting and the parked domain service.
|