www.example.com

to

anotherdomain.com

Calls to example.com (without world wide web.) shouldn't be affected about this. Normally this is easy, however the special factor relating to this is the fact that I wish to execute exactly the same script on a lot of domain names, and so i can't place the specific domain-title within the rewrite-rule.

Have you got any ideas how to get this done?

Thanks!

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://anotherdomain.com/$1 [R=301,L,QSA]