Hi there, you COULD do this in php, but it's not really the correct way to do it. What you should be doing is contacting your host, and telling them what domains you have, and they'll set it up on the server so that if you go to http://www.yourserver.com/ it will go to 1 folder, but if you go to http://www.your2ndserver.com/ it will go to the 2nd folder.
This is called a VirtualHost.
Now, if you really want to do it the other way, you'd use an if statement with the $_SERVER['HTTP_HOST'] superglobal as your condition. eg:
if($_SERVER['HTTP_HOST'] == "www.yourserver.com") {
header("Location: folder1/index.php");
exit;
} elseif($_SERVER['HTTP_HOST'] == "www.your2ndserver.com") {
header("Location: folder2/index.php");
exit;
} else {
header("Location: default/index.php");
exit;
}
or you could use a case structure:
switch($_SERVER['HTTP_HOST']) {
case 'www.yourserver.com':
header("Location: folder1/index.php");
exit;
case 'www.your2ndserver.com':
header("Location: folder2/index.php");
exit;
default:
header("Location default/index.php");
exit;
}
Cheers,
Matt