PHP Code:
<?php
$myhost="doamin.com";
$host=$_SERVER["HTTP_HOST"];
$tmp=parse_url($host);
$scheme=$tmp[scheme];
$path=$tmp[path];
$query=$tmp[query];
$host=$tmp[host];
if ($host!=$myhost){
$url=($scheme."://".$myhost.$path.$query);
header("Location: $url");
}
?>
That will redirect all the stuff with no ptoblems
Hope this will help you