Basically visit I would like it to stay there, that is working fine.
Basically visit it redirects to, that is wrong
I want it to visit because of the backreference within the RewriteCond

RewriteEngine On

RewriteCond %   !^$

RewriteCond %   !^www.(example).com [NC]

RewriteRule ^(.*)$1 [L,R]

Ubuntu 8.04
Package: apache2-mpm-prefork
Architecture: i386
Version: 2.2.8-1

Negated designs don't have any match and therefore you can't reference several that non-existing match.

But do this rule rather:

RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$1 [L,R=301]

Your problem doesn't match

RewriteCond %{HTTP_HOST}   !^www.(mysite).com [NC]

You have to change it out to complement to be able to obtain the backreference working:

RewriteCond %{HTTP_HOST}   !^[^\.]+\.(mysite)\.com [NC]