Hi all,

We recently migrated to WHM/Cpanel from Directadmin.

We have domain.com as the primary domain for the site the site in question.

With DirectAdmin it allowed "Domain Pointers" (aka Redirects) to be pointed at the domain.com. We own domain.org/.net/.co.uk which all were simply pointed at domain.com so when someone visited www.domain.co.uk it redirected to www.domain.com

When we started up with Cpanel we used the "Park Domain" option which unfortunately has simply mirrored the site. e.g.

If someone visits www.domain.co.uk it remains as domain.co.uk/page.html rather than redirect to www.domain.com/page.html

As a result, Google et al have picked up both domains/sites and we are getting penalised for duplicate content.

I am assuming the best way to tackle this is to generate rules within htaccess to solve it.

I have tried several combinations of htaccess rules to permenantly redirect any visitors who come to the site from www.domain.co.uk so it simply redirects them to www.domain.com but I haven't been able to get any to work. Some I've tried:

Code:
RewriteCond %{HTTP_HOST} ^domain.co.uk$ [OR] 
RewriteCond %{HTTP_HOST} ^www.domain.co.uk$ 
RewriteRule ^(.*)$ "http\:\/\/www\.domain\.com$1" [R=301,L]
Code:
 
redirectMatch 301 ^(.*)$ http://www.domain.co.uk
redirectMatch permanent ^(.*)$ http://www.domain.com
I'd appreciate if someone could help me with this.

What I need to do of course is preserve the entries within the search engines. So for example any entries that are present for www.domain.co.uk/about-us.html need to be redirected to www.domain.com/about-us.html

If anyone could help that would be great.

Thanks