There should be a really simple and clean way of doing this through .htaccess but I can't think of it! Redirect 301s will go into a loop, Rewrites don't change the url client side, and you can't use <VirtualHost>s in .htaccess files
Best I came up with was this in javascript:
PHP Code:
<script language="JavaScript" type="Text/JavaScript">
var url = document.location.href;
if(url.match(/domain\.com/)){
url = url.replace(/domain\.com/, "domain.co.uk");
document.location = url;
}
</script>
To be fair tho, your site shouldn't be using multiple domains anyway. It's a bad way of doing things, because after time you'll always get into trouble like this. (Although usually the trouble is with cookies). You should make it so all of your other domains have this in their .htaccess file:
PHP Code:
Redirect 301 / http://domain.co.uk/