Forum Moderators: phranque
If the two domains are actually pointing to the same filespace, then you can use .htaccess to look at the HTTP_HOST parameter, and redirect to the main domain if that's not what was asked for, e.g.
RewriteEngine on
RewriteCond %{HTTP_HOST}!^www\.desireddomain\.com
RewriteRule ^(.*)$ htt p://www.desireddomain.com/$1 [R=permanent,L]
That code says: If the HTTP host isn't the desired domain, then do a permanent redirect to the desired domain, and include any file specs that were in the request.
If, on the other hand the file names have changed from the old domain to the new domain, you have a bigger problem.
You'll have to go in for each file that has changed and use a line like this:
RedirectPermanent oldfile.htm htt p://www.newdomain.com/newname.htm
(in both cases, take out the space between the htt and the p).
It takes some time to get everything together, but that's the only way I know to do it.