301 Redirect mydomain.com to www.mydomain.com

As the title says, i'm trying to create a redirect from mydomain.com to www.mydomain.com.  I've attempted to edit htaccess_dist and i've also tried to add a new htaccess with the following code 


RewriteEngine on

rewritecond %{http_host} ^mydomain.com [nc]

rewriterule ^(.*)$ http://www.mydomain.com/$1 [r=301,nc]

I've also tried a few variations of the above code with no luck.  Some other points - the site is on a VPS using Apache and i'm NOT sure if mod_rewrite is enabled, that being said, i'm pretty sure mod_rewrite default is "enabled".

Any help would be much appreciated.