I have 3 domain names...

domain.co.uk (main domain)

* sub.domain.co.uk (sub)
* test.domain.co.uk (sub)

domain2.co.uk (addon)
domain.com (addon)

On domain.co.uk I have a subdomain 'sub.domain.co.uk'

This is located 'public_html/sub'

The 2 addon domains are both set to use the same path 'public_html/sub'

So regardless of which way you access the site, you hit the same files etc...

Ideally I only want users to visit via www.domain.com so would like to configure some for of permanent redirect.. I've been advised to do this using .htaccess and a 301 redirect.

To test this I would like to try it with domain2.co.uk and have all it's traffic redirected to www.domain.com

How do I do this as a test ??
How do I do it on the two .co.uk domain as a permanent redirect to the .com
Will this effect google ranks ?? as domain.co.uk has a good placement.

Hope this makes some for of sense..