by Sergio Rabellino.
AFAIK, moodle can serve only one hostname (=Apache directive ServerName)but you can use the apache directive ServerAlias to serve the second name for the first contact, but all the page that follow (and links) will be constructed and served by the unaliased "ServerName".
The Apache ServerName must be used into the config.php to build the url for wwwroot option.
You can try this : create a php file into the moodle root called test.php with inside
<?php
echo $_SERVER['SERVER_NAME'];
?>
and try to load it with your browser with either your two hostnames: if you obtain the two hostnames into your browser page, apache it's configured correctly, so you need to check your moodle config.
hope this helps..