$uri = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; $newUrl = str_replace(“blog.”, “www.”, $uri); header("Location: " . $newUrl);