Check both site's
.htaccess files and find the lines where it says
Your first site's
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
And your seconds site's
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
Apart from that your vhost file should have the following directives included.
ServerAlias example.com *.example.com
Allow from all
CustomLog /var/log/apache2/example_com_access.log combined