Quoting str tux str.tux@gmail.com:
But in addition, I want also some kind of redirection or mapping (i don't know what you called that) that when people go to http://mycompany.com (without www), it should forward also to the www server.
Make either A or CNAME record pointing to your web server (like you did for www.foobar.com). This will not affect email delivery for @foobar.com as long as you have MX record for it (MTA are supposed to search first for MX, then fall back to A and/or CNAME only if MX does not exist).
This will work, but you might also want to do this additional (mostly cosmetic) step. In Apache configuration, define redirection so that when people hit "foobar.com" they get redirected to "www.foobar.com". I've read somewhere that some search engines might penalize your site if they find "duplicate" content (like foobar.com and www.foobar.com being identical). I've no idea if this is just urban legend or some search engines really do that (would be nice if somebody can either confirm this, or tell if it is just a myth). However, myth or no myth, some stuff in Apache configuration gets simpler if you don't need to manage support for both foobar.com and www.foobar.com, and to be on the safe side, placing something like this in /etc/httpd/conf.d/rewrite.conf should work:
RewriteEngine On RewriteRule ^http://foobar.com(.*)$ http://www.foobar.com$1 [L,R=permanent]
You could place the above two lines into main httpd.conf file too. I simply find mora managable to have my additional stuff in separate files. If you are already using rewriting rules, you probably already have the "RewriteEngine On" line. In that case, just add RewriteRule wherever your other rewriting rules are (see Apache documentation for more details and description of L and R flags).
---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.