3) { if($host[0] == 'www') { $urlParts = array_reverse(array_slice(array_reverse($host), 0, 3)); $runCount = 0; $newSubdomain = ''; foreach($urlParts as $urlPart ) { if($runCount > 0) $newSubdomain .= '.'; $newSubdomain .= trim($urlPart); $runCount++; } if(!empty($newSubdomain)) { $newSubdomain = 'http://'.$newSubdomain; header("HTTP/1.1 301 Moved Permanently"); header("Location:".$newSubdomain.""); exit; } } } // Loadbalancer Status: 0 = Off, 1 = On echo "1"; exit;