I do this with one website with the following setup:
Both domains point to the same directory
(second.com is a ServerAlias for main.com)
in the main domain .htaccess redirects requests for second.com to a subdirectory "other"
### second.com to directory
RewriteCond %{HTTP_HOST} second.com$ [NC]
RewriteCond %{REQUEST_URI} !^/(other)
RewriteCond %{REQUEST_URI} !\.(jpe?g|js|gif|png|xml|swf|bmp|css|pdf)$
RewriteRule ^(.*)$ other/$1 [L]
### all requests to EE index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(jpe?g|js|gif|png|bmp|swf|xml|css|html?|pdf)$
RewriteRule ^(.*)$ index.php?/$1 [L]
in the "other" directory the htaccess redirects to a 'hard' template group
### Allow some of the 'real' template groups
RewriteCond $1 ^(specialgroup|sometemplategroup)
RewriteRule ^(.*)$ index.php?/$1 [L]
### All others go to hardcoded template group other/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(jpe?g|js|gif|png|bmp|xml|css|html?|swf|pdf)$
RewriteRule ^(.*)$ index.php?/other/$1 [L]
In the index.php for the subdirectory, setup some config variables
$assign_to_config['template_group'] = 'other';
$assign_to_config['template'] = 'welcome';
$assign_to_config['site_404'] = 'other/404';
$assign_to_config['site_name'] = 'My Other Site';
$assign_to_config['site_url'] = 'http://second.com/';
To be able to actually use the "site_name" and for it to work,
you need to hack the core
https://support.ellislab.com/bugs/detail/15461/#8283
or install an extension i developed for this.
http://devot-ee.com/add-ons/override_site_name
internally the 'real' segments will be second.com/other/about
while the browser only shows second.com/about
the "allow some real template groups" part, allows to show
member pages or 'real' template groups like the /specialgroup
or /members
without prepending other
to the url.
all assets (images, pdf, css, etc) still come from the main directory. The subdirectory 'other' only has an .htaccess and the index.php file in there.