If the user enters from the url myDomain.com, I want redirect the url to www.myDomain.com automatically. How do I do this on Apache? I seem to remember that this can easily be done using .htaccess or adding an entry in httpd.conf, but I cannot recall exactly how. (By the way, if I do this, then Google will replace myDomain.com with www.myDomain.com, right? As of right now, Google lists myDomain.com, but I want www.myDomain.com to be listed. This is the website in question, FYI.)
If you are doing that just for google results to appear with www. then you can do that through Google Webmaster Tools. Join there, and you will find that option under Tools > Set preferred domain and then check option "Display URLs as www.yourdomain.com". That's it, on the next update google should start showing your site results with www.yourdomain.com You can put a redirection on server side also, to redirect from http://yourdomain.com to http://www.yourdomain.com as an additional measure.