One website: two domains - how to avoid duplicate content?

Hi,
I’m working with a client who currently has two domains. Instead of just redirecting domain A to domain B, the whole site has been duplicated. Not sure why their previous web developer set it up this way as it seems like a messy way of setting things up: SEOgets diluted and two sites need to be maintained. What would be the benefits?

Anyway, I am building a new site for my client and simply want to redirect domain B to domain A. The site only exists at domain A. I can easily set this up, however I’m concerned that all the domain B pages that have been indexed by Google will now return 404 errors.

Is there a way to redirect all the domain B pages to domain A? Do I simply do this on the hosting company’s cPanel OR do I need to set up a rewrite file of some sort?

Thanks.

Copy/Paste in .htaccess file of domain B and change newdomain.com to domain A

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !newdomain.com$ [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301]

You could also make a landing or intro page for each domain that links to your main site but also can be used to post some more content that is optimized for the keywords of that specific domain.

No they won’t. If you do a 301 redirect from each page in B to the corresponding page in A, then they won’t generate 404s. Furthermore, any page rank that B previously enjoyed will now pass to A.

Mike

Correct. Everything he said.

I have always been wondering that is there any difference between redirecting one of your domain to another using .htaccess and the redirecting function provided by the domain provider?

I always assumed the domain provider just inserts the htaccess code for you. Im 99% sure thats the case.