cd34 - shouldnt this be taken care of in the server config with the servername set to
www.domain.com - so that it always defaults to that?
Although I do agree that the above code for the htaccess works just as well to ensure that you dont have the splitting problem and takes care of the case where Google already knows about both versions
