How do you use apache to redirect from
YYYY.domain1.com/ZZZZ.html
to
www.domain2.com/YYYY/ZZZZ.html
where YYYY and ZZZZ can be anything?
Or, even better, if it can be done, on the second site, using mod_rewrite, have
YYYY.domain2.com/ZZZZ
be the same as
www.domain2.com/cgi-bin/file.cgi?name1=YYYY&name2=ZZZZ
so you redirect from
YYYY.domain1.com/ZZZZ.html
to
YYYY.domain2.com/ZZZZ.html
that, using mod_rewrite, is actually accessing
www.domain2.com/cgi-bin/file.cgi?name1=YYYY&name2=ZZZZ
If it helps, I'm using my own two IP addresses for the domains Nameservers.