Code:
<?
// this separates it into an array [0]=>sub, [1]=>domain, [2]=>tld
$exploded = explode(".", $_SERVER['HTTP_HOST']);
// just redirects to http://someotherdomain.com/sub
header("Location: http://www.someotherdomain.com/" . $exploded[0]);
?>
untested but should work.