I want to redirect guest to user1's blog while he/she access www.user1.com, and redirect guest to user2's blog while he/she accesswww.user2.com
<?php
$domain = strtolower($_SERVER["HTTP_HOST"]);
$USER1_URL = "/Blog/user1";
$USER2_URL = "/Blog/user2";
$urlDict = array(
"www.user1.com" => $USER1_URL,
"user1.com" => $USER1_URL,
"www.user2.com" => $USER2_URL,
"user2.com" => $USER2_URL);
$redirectUrl = "";
$redirectUrl = $urlDict[$domain];
if($redirectUrl!="")
{
header("Location: $redirectUrl");
echo $redirectUrl;
}
else
{
echo "<h1> You are staying on this page</h1><p>";
}
?>