I'm looking after a server which supports multiple domains, though we don't have control of the DNS server.

What I'm trying to do is cope with the situation where the 'www.' is missing, i.e. onedomain.com, is to use www.onedomain.com, using the httpd.conf file. At the moment, the DNS server is sending the requests to the web server but because it doesn't know the domain name, they're just dropping through to the default site.

It seems to me that something like the following ought to be what I want but I've never dabbled in this rewrite stuff before and could well be hopelessly off target:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^/(.*) http://%{HTTP_HOST}/$1 [R=301]

I hope someone can point me in the right direction because, without a single method of doing it for all hosted domains, I'm going to have to add a lot of extra VirtualHost stuff to the conf file!