Redirecting non-www to www url can be simply done by adding a virtual host configuration. For example, if i have a domain ykyuen.com and i want to redirect it to http://www.ykyuen.com, just add the following virtual host.
<VirtualHost *:80> ServerAlias ykyuen.com RedirectMatch permanent ^/(.*) http://www.ykyuen.com/$1 </VirtualHost>
Restart the Apache and it should work.